From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id WKr3AM5mjWZfMAAAqHPOHw:P1 (envelope-from ) for ; Tue, 09 Jul 2024 16:35:26 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id WKr3AM5mjWZfMAAAqHPOHw (envelope-from ) for ; Tue, 09 Jul 2024 18:35:26 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="KuYCo/eb"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1720542925; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=6lP+UNR6pU44Sm4dKtMfrstFr+pJ2GfKZ/ZTUjtrXgc=; b=e+MIlFmisJ+/XsO+6sPA3ycHEB7QSUqeYVsHdYat6qtArIaHPURt7YrZaks37DLRQvbxoO BkjsZHf3NAsLaf9YkjWDCt4DweSU/dhVzFpwpw3a7Rmoe1JrOq98k7J2bPoH+kHuXr3pQt feMYbTJxcxc5auTC2gT+XYUPBZMNnZDwQAmV+1eIJ4g0i7Ubiu4NyVPnjFOVCEx3jzV/U2 eWwNNqhnzm918W6EpfAFwFxk03yBFJxoz3YmAQmCKanGZ8+zJ5EWesfB/v7YK8eWjwlSfT rufzZRto0OjbY9dP2nhzQwGS+GCYUmvODmjAqHh0iCiJ3kFn4lkMfqF9zu4qYA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1720542925; a=rsa-sha256; cv=none; b=Sjc+s8JXBmx58jOmJec1/iSNs8+9EUZOPP96W2WfFhZF5LZmA8Lcvf9VlcBNk/4Ona6c1G qhBT4bCaDnQSVC61FIWnSYFEsnUEeO9T4X+dnxTdXPklFCNigbFjwZzFZujko5XfH0eN+V Q72Hltzg8u4f3EzBImGOs+1cUs+MAM5Cg9tAyvBNARWR+I5RTjA0H9ztS6/4LplJPVeozl JeYIfq4aaTK3v2Z9b0FbBi42/60a6NWf1l4xlQFMC8dt2YmAVsWuPJcMxzNIYZIx99wCde XyfBle6v/MM0qYRuvCLZ3/QDsLnVusi/GfdMGTCBr8tjNwrgLRGjoTgfT+MK1Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="KuYCo/eb"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id D8002651CD for ; Tue, 9 Jul 2024 18:35:25 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sRDnb-0004rM-OW; Tue, 09 Jul 2024 12:34:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sRDnY-0004qT-NK for emacs-orgmode@gnu.org; Tue, 09 Jul 2024 12:34:36 -0400 Received: from mail-qv1-xf31.google.com ([2607:f8b0:4864:20::f31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sRDnX-0002Vv-5X for emacs-orgmode@gnu.org; Tue, 09 Jul 2024 12:34:36 -0400 Received: by mail-qv1-xf31.google.com with SMTP id 6a1803df08f44-6ad86f3cc34so25351576d6.1 for ; Tue, 09 Jul 2024 09:34:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720542871; x=1721147671; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=6lP+UNR6pU44Sm4dKtMfrstFr+pJ2GfKZ/ZTUjtrXgc=; b=KuYCo/ebkxEe9Ldq50O3tMIkCrfPWoY6HjTm4yaVWuKJVIe3dOUEh6Bfnyp+X2W4Du I7T2yQH4naUm6UKO99VOkFR3Ne4oU8PrvWhRoIlVsEjsVpzFAVVzTUDmBxaRyBIbkgpI QZgUfCIsuh75ae6M4fPRIJeqlWWPnNSSNRcr2b9Ci0QfQMCMAW7qb9Lo4+6MSvQiuErA JRePhIoS8bYvXMU6v93bfUF9tKiJNALZRtkQluOLImec/7yFS/B/3UKMrHGIGn01+TSi AnHYL1+YKEpTwAmuqoe4W5S3i2bI7b0vxsPoILdKSplBsTvRBqVFzK3wfgh1MMMHj4iE 6ggA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720542871; x=1721147671; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=6lP+UNR6pU44Sm4dKtMfrstFr+pJ2GfKZ/ZTUjtrXgc=; b=mIRlPkq924rT4St/eeVbuLBaw9D/pvT/r3yeOgkR8OatLIIV8R626aLa5vKZK9rryi jSQSbd1OJn3Hv5VVcq9eOHKyTvlCNlbxuVxdjkgUH2ZST30Q1+Wbi/CRUZ6b1R6oZTDT JuIAW+hXNRp2L9980VCPVn+LXffBZKH2KPlcSbtEQDWn4pHI7nI+lhOFu6nOOE6bkGS4 DU0UPD1+PWqqMD6aKlMH+5Z70Wf6K5r7+snz/Pg6X+OEY/w7+vDg68zKuy8l8/Z4jial 5uDJlSN7KL/yzIyXAFdzx82O+HHUPUKy+IINaVSZCGMENbuipvvLXmER1PWe73oeVUSf PGXg== X-Gm-Message-State: AOJu0YxsQKvIZzRvIBZuqXdLy/CnS7YH6HgNCKbNGnVUlazgsQvp+SsR Uox1B1o+u0i4BYYxQ5EPRYe7J/4Ytl0SUGcy8+nOT22QzcIm47S+CqUsp4ZnGH9uprI0Ae+DoFq DdVlC43sFVUdeLA2rdpTGzAULy32ggvQH X-Google-Smtp-Source: AGHT+IGVjoB37Rc+9oN63L8gIXrqgnhP436qs7H3eiLL6Ibj5LkjxUkEV8kiCfhQKz7mSRtxu+vlF7qrUkA34qwAu0s= X-Received: by 2002:a05:6214:401c:b0:6b5:e77b:b785 with SMTP id 6a1803df08f44-6b61c1c7d32mr41565496d6.48.1720542871358; Tue, 09 Jul 2024 09:34:31 -0700 (PDT) MIME-Version: 1.0 From: Brice Waegenire Date: Tue, 9 Jul 2024 18:34:20 +0200 Message-ID: Subject: [BUG] org--plot/sensible-tick-num when range is a power of 10 To: emacs-orgmode@gnu.org Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2607:f8b0:4864:20::f31; envelope-from=brice.wge@gmail.com; helo=mail-qv1-xf31.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Queue-Id: D8002651CD X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -8.24 X-Spam-Score: -8.24 X-TUID: Z6JyzcXnF7Y8 Hello, I've found a bug in =org--plot/sensible-tick-num=, when a plot has a range of a power of 10 (1, 10, 100, ...). To reproduce, run =org-plot/gnuplot= on the following plot: #+plot: type:radar min:0 max:10 | Metric | Value | |---------+-------| | alpha | 2 | | beta | 4 | | gamma | 6 | | delta | 8 | | epsilon | 10 | It produce the error: =let*: Wrong type argument: number-or-marker-p, nil=. A workaround is to fix the =ticks= value for example by appending =ticks:5= to the plot line. I'm not really sure how to correctly fix that bug, but the following function work fine, at least for my use case. When =org-plot/prime-factors= return =nil=, it returns ='(5)= instead: #+begin_src elisp (defun org--plot/sensible-tick-num (table &optional hard-min hard-max) "From a the values in a TABLE of data, guess an appropriate number of ticks. If HARD-MIN and HARD-MAX can be used to fix the ends of the axis." (let* ((row-data (mapcar (lambda (row) (org--plot/values-stats (mapcar #'string-to-number (cdr row)) hard-min hard-max)) table)) (row-normalised-ranges (mapcar (lambda (r-data) (let ((val (round (* (plist-get r-data :range-factor) (plist-get r-data :nice-range))))) (if (= (% val 10) 0) (/ val 10) val))) row-data)) (range-prime-decomposition (mapcar (lambda (row-normalised-range) (or (org--plot/prime-factors row-normalised-range) '(5))) row-normalised-ranges)) (weighted-factors (sort (apply #'org--plot/merge-alists #'+ 0 (mapcar (lambda (factors) (org--plot/item-frequencies factors t)) range-prime-decomposition)) (lambda (a b) (> (cdr a) (cdr b)))))) (apply #'* (org--plot/nice-frequency-pick weighted-factors)))) #+end_src Cheers, -- bricewge ~ 8929 BBC5 73CD 9206 3DDD 979D 3D36 CAA0 116F 0F99