Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maxima plot with dashed line

Tags:

plot

maxima

How can we plot in maxima with different line styles (for example dash, dash-dot, etc. and not just change the color of the lines). Minimal working example:

f(x) := sin(x) $
g(x) := cos(x) $
plot2d( [f(x), g(x)], [x,0,10], 
        [style, [lines, 1,4], [lines, 1,3]] )$

The above can probably be done with the style option of plot2d. However, I cannot find the right option.

like image 240
ASarkar Avatar asked Jan 31 '26 23:01

ASarkar


1 Answers

One way is to set linetype in gnuplot_preamble.

f(x) := sin(x) $
g(x) := cos(x) $

p: "set linetype 1 dashtype '-'
    set linetype 2 dashtype '.'" $

plot2d(
  [f('x), g('x)], ['x, 0, 10],
  ['gnuplot_preamble, p],
  ['style, ['lines, 4, 4], ['lines, 4, 3]])$

enter image description here

like image 59
slitvinov Avatar answered Feb 04 '26 01:02

slitvinov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!