Re: [Gnuplot-py-users] 2d and 3d plot together

 Re: [Gnuplot-py-users] 2d and 3d plot together From: Michael Haggerty - 2013-10-24 07:57:27 ```[Please always CC your replies to the mailing list as well.] On 10/24/2013 09:35 AM, Tomáš Odstrčil wrote: > It is possible to do it in gnuplot, I'm using the following command (the > last line is important) > set xrange [1:5]; > set yrange [-2:2]; > set style line 1 lt 2 lc rgb 'white' lw 2; > set style line 2 lt 1 lc rgb 'gray' lw 1; > set title 'title'; > set xlabel 'xlabel > set ylabel 'ylabel' > unset key > set term png transparent size 600,600 crop; > set output 'filename.png'; > set view map; > set pm3d explicit; > splot 'data.txt' with image, 'line.txt' using 1:2:(0) ls 1 with lines Ahh, I see, you are doing a "2-d" line plot by doing a 3-d line plot whose z values are always zero. The same trick works in Gnuplot.py: import math, numpy import Gnuplot g = Gnuplot.Gnuplot() theta = numpy.arange(-math.pi, math.pi, 0.1) x = numpy.cos(theta) y = numpy.sin(theta) g.splot( Gnuplot.Func('x*x + y*y'), Gnuplot.Data(x,y, using='1:2:(0)', with_='line'), ) or you can pass the zero data to gnuplot explicitly using something like g.splot( Gnuplot.Func('x*x + y*y'), Gnuplot.Data(x,y,numpy.zeros(len(t)), with_='line'), ) Michael -- Michael Haggerty mhagger@... http://softwareswirl.blogspot.com/ ```

 [Gnuplot-py-users] 2d and 3d plot together From: Tomáš Odstrčil - 2013-10-23 16:53:33 Attachments: Message as HTML ```Hi everyone, gnuplot-py is a great program, however is it possible to show a 2d and 3d plot in the same image? I would like to plot a pseudocolor graph by splot method and with some lines by plot method but the plot method always clear the image before plotting . Best Regards, Tomas ```
 Re: [Gnuplot-py-users] 2d and 3d plot together From: Michael Haggerty - 2013-10-24 04:43:07 ```On 10/23/2013 06:53 PM, Tomáš Odstrčil wrote: > gnuplot-py is a great program, however is it possible to show a 2d and > 3d plot in the same image? I would like to plot a pseudocolor graph by > splot method and with some lines by plot method but the plot method > always clear the image before plotting . That's more a question about gnuplot than about gnuplot.py. I don't think it was possible years ago when I last used gnuplot regularly, but it might have changed. Michael -- Michael Haggerty mhagger@... http://softwareswirl.blogspot.com/ ```
 Re: [Gnuplot-py-users] 2d and 3d plot together From: Michael Haggerty - 2013-10-24 07:57:27 ```[Please always CC your replies to the mailing list as well.] On 10/24/2013 09:35 AM, Tomáš Odstrčil wrote: > It is possible to do it in gnuplot, I'm using the following command (the > last line is important) > set xrange [1:5]; > set yrange [-2:2]; > set style line 1 lt 2 lc rgb 'white' lw 2; > set style line 2 lt 1 lc rgb 'gray' lw 1; > set title 'title'; > set xlabel 'xlabel > set ylabel 'ylabel' > unset key > set term png transparent size 600,600 crop; > set output 'filename.png'; > set view map; > set pm3d explicit; > splot 'data.txt' with image, 'line.txt' using 1:2:(0) ls 1 with lines Ahh, I see, you are doing a "2-d" line plot by doing a 3-d line plot whose z values are always zero. The same trick works in Gnuplot.py: import math, numpy import Gnuplot g = Gnuplot.Gnuplot() theta = numpy.arange(-math.pi, math.pi, 0.1) x = numpy.cos(theta) y = numpy.sin(theta) g.splot( Gnuplot.Func('x*x + y*y'), Gnuplot.Data(x,y, using='1:2:(0)', with_='line'), ) or you can pass the zero data to gnuplot explicitly using something like g.splot( Gnuplot.Func('x*x + y*y'), Gnuplot.Data(x,y,numpy.zeros(len(t)), with_='line'), ) Michael -- Michael Haggerty mhagger@... http://softwareswirl.blogspot.com/ ```