October 6th, 2010 | 14 Comments
If we want to plot a single point, we can do this by creating a data file, containing only one line:
# x y 1 2
But there exist an easier method without any additional data file. In Fig. 1 three points with different symbols are plotted.
To achieve this we just use the following command:
plot '-' w p ls 1, '-' w p ls 2, '-' w p ls 3 1 2 e 2 1 e 3 1.5 e
We use the possibility to tell Gnuplot with the '-'
input to read from standard input. Here we tell Gnuplot to do this three times. After the plot command the data is entered. Every single data entry have to ended with the e
line.
In order to have different symbols for the points we set them before:
set style line 1 lc rgb 'black' pt 5 # square set style line 2 lc rgb 'black' pt 7 # circle set style line 3 lc rgb 'black' pt 9 # triangle
Note: if we want to use the replot
command then the above code will not work probably. But the same can be achieved by using:
plot "<echo '1 2'" with points ls 1, \ "<echo '2 1'" with points ls 2, \ "<echo '3 1.5'" with points ls 3
This was really helpful.
When I plot using the open symbols like pt 4 or pt 6 they always have a little dot in the center. Is there anyway to avoid this?
Thanks,
Morri
Yes, I know the annoying little dot at the center.
I’m using mostly postscript (eps) files. After plotting I open them in Inkscape and remove the little dot.
For png or other terminals I have no solution at the moment.
[…] es una traducción a Español de un post en inglés. Me pareció interesante proporcionar esta información traducida al español. Espero que sea de […]
I really like your blog.. very nice colors & theme. Did you make this website yourself or did you hire someone to do it for you? Plz respond as I’m looking to construct my own blog and would like to know where u got this from. thank you fegbdefffeae
Hi Johne,
I made it by myself using Bootstrap as a basis which is a very good start if you have some HTML/CSS knowledge. The color theme is inspired by Tarski which I used for an early version of the blog.
Thank you very very very much! That article helped me a lot!
Makes me think
This is a bit of an abuse, but useful for calculated locations.
That’s true and it can be formulated even shorter using the special filename
sorry,
ax, ay do not need to be preset, you may write your numbers straight after "< echo"
How does this work with variables? i just get
Bad data on line 1 of file < echo ax ay
But it does seem to work with explicit numbers.
Hi Joe.
The easiest way is the one stated above
Otherwise you can do
Hi,
Please some one tell how to make a best fit point in contour plots using gnuplot ??
Thank you
Bolches yarboclos
This doesn’t work