Closed rtoy closed 2 months ago
Imported from SourceForge on 2024-07-05 18:34:42 Created by ebertocchi on 2022-11-17 11:09:52 Original: https://sourceforge.net/p/maxima/bugs/4046/#8ef7
One of the attachments disappeared, I reattach it here.
Attachments:
Imported from SourceForge on 2024-07-05 18:34:46 Created by robert_dodier on 2022-11-19 20:54:44 Original: https://sourceforge.net/p/maxima/bugs/4046/#ce14
Imported from SourceForge on 2024-07-05 18:34:49 Created by robert_dodier on 2022-11-19 20:54:44 Original: https://sourceforge.net/p/maxima/bugs/4046/#1a56
Hi Enrico, can you try it with the current version (Maxima 5.46.0)? The plotting functions have been updated in recent versions, it's possible the behavior is different.
Imported from SourceForge on 2024-07-05 18:34:53 Created by robert_dodier on 2022-11-20 01:44:23 Original: https://sourceforge.net/p/maxima/bugs/4046/#fc2c
Okay, I've confirmed the bug is present in Maxima 5.46.0. Here's another example of the same problem:
plot2d ([x^2, x^3, %i*x^4, %i*x^5, x^6], [x, 0.1, 1], [legend, "y1", "y2", "y3", "y4", "y5"]);
The plot shows legends y1
, y2
, and y3
, instead of y1
, y2
, and y5
.
I will try to see if it is present the current post-5.46 development version.
Imported from SourceForge on 2024-07-05 18:34:56 Created by robert_dodier on 2022-11-20 02:02:28 Original: https://sourceforge.net/p/maxima/bugs/4046/#1e6e
Okay, the bug is present in the current post-5.46 development version.
Imported from SourceForge on 2024-07-05 18:34:59 Created by tomio-arisaka on 2022-11-24 12:33:03 Original: https://sourceforge.net/p/maxima/bugs/4046/#7b96
Xmaxima also has the same issue.
(%i2) plot2d ([x^2, x^3, %i*x^4, %i*x^5, x^6], [x, 0.1, 1], [legend, "y1", "y2", "y3", "y4", "y5"], [plot_format, 'xmaxima]);
plot2d: expression evaluates to non-numeric value everywhere in plotting range.
plot2d: expression evaluates to non-numeric value everywhere in plotting range.
(%o2) [/var/folders/58/sd7gn5sn04dc1gg55cmx6vg40000gn/T/maxout27789.xmaxima]
My temporary patches are here:
--- src/gnuplot_def.lisp.orig 2022-11-18 21:45:52.000000000 +0900
+++ src/gnuplot_def.lisp 2022-11-24 05:00:01.000000000 +0900
@@ -503,6 +503,12 @@
(mapcar #'(lambda (f) (cdr (draw2d f range options))) (cdr fun)))
(when (= (count-if #'(lambda (x) x) points-lists) 0)
(merror (intl:gettext "plot2d: nothing to plot.~%")))
+ (let ((legends-new) (legends (getf options :legend)))
+ (unless (null legends)
+ (dotimes (i (length legends))
+ (unless (null (cdr (nth i points-lists)))
+ (push (nth i legends) legends-new)))
+ (setf (getf options :legend) (reverse legends-new))))
(setf
(slot-value plot 'data)
(concatenate
--- src/xmaxima_def.lisp.orig 2022-11-18 21:45:52.000000000 +0900
+++ src/xmaxima_def.lisp 2022-11-24 05:00:00.000000000 +0900
@@ -247,6 +247,12 @@
(mapcar #'(lambda (f) (cdr (draw2d f range options))) (cdr fun)))
(when (= (count-if #'(lambda (x) x) points-lists) 0)
(merror (intl:gettext "plot2d: nothing to plot.~%")))
+ (let ((legends-new) (legends (getf options :legend)))
+ (unless (null legends)
+ (dotimes (i (length legends))
+ (unless (null (cdr (nth i points-lists)))
+ (push (nth i legends) legends-new)))
+ (setf (getf options :legend) (reverse legends-new))))
(setf
(slot-value plot 'data)
(concatenate
I checked the patches with SBCL-2.2.10 on macOS 10.13.
Imported from SourceForge on 2024-07-05 18:35:03 Created by robert_dodier on 2023-02-07 22:29:08 Original: https://sourceforge.net/p/maxima/bugs/4046/#7b96/2764
Hi Tomio-san, can you please commit the patches? Thanks for working on this problem.
Imported from SourceForge on 2024-07-05 18:35:06 Created by robert_dodier on 2023-02-09 05:42:51 Original: https://sourceforge.net/p/maxima/bugs/4046/#9245
Fixed by commit [ 3b71444 ]. Thanks for your help, Tomio. Closing this report.
Imported from SourceForge on 2024-07-05 18:34:41 Created by ebertocchi on 2022-11-17 11:08:21 Original: https://sourceforge.net/p/maxima/bugs/4046
Tested on Maxima 5.44.0 GCL, see the attached build info.
The plot2d legend option associates the first (second, third...) curve label to the first (second, third...) not "everywhere non-numeric" function, ad not, as possibly expected, to the first (second, third...) function in the list, regardless from the outcome of its numerical evaluation.
A .mac script is attached, which produces the unexpected behaviour.
Sincerely, -- Enrico
Attachments: