exitif(strstrt(GPVAL_TERMINALS,"aqua")!=0)setterminalaqua;else set term x11;if(strstrt(GPVAL_TERMINALS,"aqua")!=0)setterminalaqua;else set term x11;if(strstrt(GPVAL_TERMINALS,"aqua")!=0)setterminalaqua;else set term x11;
Neither x11 terminal nor the aqua terminal are openend, and nothing else seems to happen.
What went wrong here? Gnuplot (5.4.2) is installed (MacPorts 2.7.1) and in PATH. Why do direct calls of gnuplot not work? What do I need to be doing to get direct calls of gnuplot going?
Tilda
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You're welcome. I guess that gnuplot changed its defaults at some point in the past. Another example is that "set noparametric" is deprecated in favour of "unset parametric".
Rainer
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you, Rainer, for the clarification. I would also like to ask a question concerning the error messages: it shows that reduce always sets aqua or x11 as terminal type. I tried
gnuplot(set, term, wxt);
on linux, and it had no effect. Am I doing something wrong, or is it only possible to use x11?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
These are not error messages: these are the commands to set the terminal that are sent to gnuplot, shown because the trplot switch is set to on. You can change them by setting the symoblic mode variable gnuplot_select_terminal!*, e.g. to use the wxt terminal:
symbolic(gnuplot_select_terminal!* :="if(strstrt(GPVAL_TERMINALS,""aqua"")!=0)set terminal aqua;else set term wxt;");
Commands sent via the Reduce gnuplot command are not shown for some reason.
Rainer
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Declare isosamples operator ? (Y or N)
Type Y or N
uplot(set,xrange[-2$$$:2]);
at line 7
***** Improper delimiter
gnuplot(set,yrange[-2$$$:2]);
at line 7
***** Improper delimiter
So what would be the correct delimiter for the gnuplot(set,xrange)command. And is it possible to effectively set gnuplot(set,isosamples 40) and gnuplot(set,samples 40) as well as titles via gnuplot(set,title "Exponential Function") which all don' seem to be working as desired.
Tilda
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the hints, Rainer. I've tried them and they work fine. Yet, your answer raises some questions.
Are the x=(-2 .. 2)/96 and y=(-2 .. 2)/96 instructions in your code equivalent to gnuplot(set,isosamples,96); or gnuplot(set,samples,96); or both in mine?
How would you rewrite gnuplot(set,xyplane,"at -0.6"); in your code ?
Why do you suggest letting Reduce do the as much work as possible. Is it because it can evaluate (more demanding) functions better than gnuplot?
Why has the plot form your code the x-axis shifted by 90 deg clockwise compared to mine? Differently put, your code yields the same results as stand-alone gnuplot; direct calls of gnuplot from within Reduce don't, even though the instruction are equivalent.
Cheers
Tilda
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry for the delay in responding. I needed to look at the plot/gnuplot code in Reduce and check a couple of examples before answering, but have been busy with other things.
Both are roughly equivalent, but the mechanism is different. When you use the Reduce plot command, Reduce computes the grid points, writes them to a data file and displays that using gnuplot. My example above translates into these gnuplot commands:
set term x11
unset hidden3d
unset pm3d
set view 60,30,1,1
set size 1,1
set xlabel "y"
set ylabel "x"
set zlabel "z"
set title "REDUCE Plot"
unset contour
unset polar
set parametric
set view 45,135
set pm3d
set hidden3d
set title "Exponential Function"
unset key
splot '/tmp/rainer.plotdt1' with lines
There is no equivalent way to specify the xyplane in the plot command. If there is interest, I can add this option, e.g. as xyplane="at -0.6"
If you use only the gnuplot command, why do you need Reduce? You can type in the very same commands into gnuplot directly. On the other hand, you are limited to the functions that gnuplot understands.
I think that set parametric causes the different view.
Regards,
Rainer
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm currently working with Reduce (Free PSL version, revision 5595), 17-Jan-2021) from within a TeXmax (2.1) Reduce session on OSX 13.7.
Symbolic and numerical calculations work fine. So does gnuplotting by using the
plot(...)
-command. However, when I want to call gnuplot directly, e.g.I get the following error message:
Neither x11 terminal nor the aqua terminal are openend, and nothing else seems to happen.
What went wrong here? Gnuplot (5.4.2) is installed (MacPorts 2.7.1) and in PATH. Why do direct calls of gnuplot not work? What do I need to be doing to get direct calls of gnuplot going?
Tilda
I can confirm the same result on Linux (Ubuntu 20.04 LTS), with Reduce CSL rev. 5758. Same result after each command, except the exit, no plot window.
For polar plots the dummy variable is t, not x. Try
or
as third line.
I'll update the manual.
Rainer
Thanks for the fast reply, Rainer. That really solved the problem.
Tilda
You're welcome. I guess that gnuplot changed its defaults at some point in the past. Another example is that "set noparametric" is deprecated in favour of "unset parametric".
Rainer
Thank you, Rainer, for the clarification. I would also like to ask a question concerning the error messages: it shows that reduce always sets aqua or x11 as terminal type. I tried
gnuplot(set, term, wxt);
on linux, and it had no effect. Am I doing something wrong, or is it only possible to use x11?
These are not error messages: these are the commands to set the terminal that are sent to gnuplot, shown because the trplot switch is set to on. You can change them by setting the symoblic mode variable
gnuplot_select_terminal!*
, e.g. to use the wxt terminal:Commands sent via the Reduce gnuplot command are not shown for some reason.
Rainer
I have some questions on direct gnuplot-calls in general and some on specific calls in particular.
Some calls seems to be working straight, others produce error messages, e.g when running
I get the following:
So what would be the correct delimiter for the
gnuplot(set,xrange)
command. And is it possible to effectively setgnuplot(set,isosamples 40)
andgnuplot(set,samples 40)
as well as titles viagnuplot(set,title "Exponential Function")
which all don' seem to be working as desired.Tilda
The gnuplot command behaaves like every other Reduce command, i.e. if you write
isosamples 40
it is evaluated.Try this:
Rainer
Thanks for the clarification, Rainer. You 've been a tremendous help! For those on the forum interested in further enhancements may just try this one:
Cheers
Tilda
But that is using nearly none of the Reduce facilities, since it passes the function to plot to gnuplot.
Try this:
Rainer
Thanks for the hints, Rainer. I've tried them and they work fine. Yet, your answer raises some questions.
x=(-2 .. 2)/96
andy=(-2 .. 2)/96
instructions in your code equivalent tognuplot(set,isosamples,96);
orgnuplot(set,samples,96);
or both in mine?gnuplot(set,xyplane,"at -0.6");
in your code ?Cheers
Tilda
Sorry for the delay in responding. I needed to look at the plot/gnuplot code in Reduce and check a couple of examples before answering, but have been busy with other things.
plot
command, Reduce computes the grid points, writes them to a data file and displays that using gnuplot. My example above translates into these gnuplot commands:There is no equivalent way to specify the xyplane in the
plot
command. If there is interest, I can add this option, e.g. asxyplane="at -0.6"
If you use only the
gnuplot
command, why do you need Reduce? You can type in the very same commands into gnuplot directly. On the other hand, you are limited to the functions that gnuplot understands.I think that
set parametric
causes the different view.Regards,
Rainer
Dear Rainer, thank you for your helpful comments. Implementing an
xyplane
option would be a nice feature to have.Tilda