Open ReneSci opened 8 months ago
Two axis are possible - and I use them frequently:
wxdraw2d(
explicit(sin(x),x,0,2*π),
xlabel="x [rad]",
xlabel_secondary="x [°]",
xrange_secondary=[0,360],
xaxis_secondary=true,
xtics_secondary=true,grid=[5,5]
);
But multiplots aren't currently possible for maxima's png
and pngcairo
output that wxMaxima uses - and what draw is missing is the possibility to add raw gnuplot commands: There is gnuplot_preamble
, but you cannot insert a
set ytics offset -8, 0
into exactly the current place in the gnuplot file maxima creates. Both features would be possible feature requests for the maxima project, though: At least the latter I would use from time to time.
Well - if the function can be expressed using Gnuplot commands and you just want to include it in a wxMaxima worksheet, the following trick may help:
(Code taken from the Stackoverflow page you referenced).
Here I am plotting the function y=0 (with x= 0-10), so it is not shown - and afterwards I insert the gnuplot commands using gnuplot_postamble
. Quotes need to be escaped, of course.
wxplot2d(0,[x,0,10],[gnuplot_postamble,"
set multiplot
clear
set xrange[0:10]
# We need place to the left, so make the left margin 30% of screen
set lmargin screen 0.3
##### first plot
set ytics 0.4
set yrange[-1.2:1.2]
set ylabel \"Voltage\" textcolor rgb \"red\"
plot sin(x)
##### Second plot
set ytics 1
set yrange[-3:3]
set ytics offset -8, 0
set ylabel \"Current\" offset -8, 0 textcolor rgb \"green\"
plot 3*cos(x) linecolor 2
##### Third plot
set ytics 0.5
set yrange[-1.5:1.5]
set ytics offset -16, 0
set ylabel \"Power\" offset -16, 0 textcolor rgb \"blue\"
plot 3*sin(x)*cos(x) linecolor 3
unset multiplot"])$
Would it be possible to implement some gnuplot code that makes plots like this possible?![image](https://github.com/wxMaxima-developers/wxmaxima/assets/2638713/a8ff90b1-0697-4fc3-8344-776e7565ae87)
https://stackoverflow.com/questions/27390317/how-to-plot-multiple-y-axes