In the past year, I have been trying to argue on these pages that gnuplot has some advantages over many other plotting utilities. Ultimate control over graph properties, the simplicity of plotting, the ease of scripting. These are the strengths of gnuplot that spring to mind first. At least, to my mind. At the same time, I also have to admit that there are weaknesses. And these weaknesses all come down to the same deficiency: the lack of a certain modularity, both at the user level, and in the code. This makes expanding gnuplot extremely difficult, at times, impossible. At the user level, we have to use what we have, and there are not too many options when it comes to even such simply tasks as calculating the average of a data set. If something is not implemented in the code, the user is not "supposed" to use it. Now, in gnuplot 4.4, some of these problems can be overcome with some witty scripting, and mainly, abuse of procedures. If you want to see some nasty hacks, just skim through these pages. And these issues all become even more problematic, when it comes to trying to fix the problem at the developer's level. The code, as it is written now, does not support straightforward expansion, even implementing as simple things as, again, calculating the average of a data set are somewhat tricky. At yet another level, even if the code is fixed, the original gnuplot code is not published under GPL, therefore, changing it does not mean that the battle is won: one can't just take the code, modify it, and put it up on a web page.
These were the problems that I have realised in the past couple of years, and this is why I decided to re-think certain things, and start the development of a plotting utility. I wanted to keep what was good in gnuplot, but I wanted to right the wrongs. I was seriously pondering where and how to set out, when someone pointed out to me that I am not the first person, who faces the same dilemma, and that there is another project already underway. In fact, the other project was quite advanced, when I caught glimpse of it. And I have to say that what I saw was rather impressive. It impressed me, because its development is done along the lines that I mentioned above, it is thought-over well, and it is already quite mature. It can easily compete with gnuplot, for most things are already implemented, and it has the modularity that I missed so much. And it is under GPL, so you can do whatever you want. Well, almost.
With these remarks, I would like to call your attention to pyxplot. If you haven't seen it yet, please, visit the web site, and give it a try! Their main site is here, and you can find a number of very pleasing plots here. Most of your gnuplot scripts will work "out of the box", and those that won't, can be tweaked very easily. At the end of the pdf manual, you can find a discussion on what the differences between gnuplot and pyxplot are, and how you can make your scripts work. At the same time, enjoy the convenience of easy unit manipulations, data analysis, things like Fourier transforms and filtering, numerical integration and differentiation, the option for defining not only simple functions but procedures for your common tasks.
As a concluding remark, I would also like to announce a parallel blog of mine, pyxplot-tricks, where I will discuss how and what can be achieved in pyxplot. I will still try to keep gnuplot-tricks active, and I will certainly answer questions posted here.
Cheers,
Zoltán
Thursday, 26 August 2010
Subscribe to:
Post Comments (Atom)
For someone so proficient with gnuplot it's impressive to see you're open to alternatives.
ReplyDeleteI'll have a look at pyxplot. Thanks!
Looks like it's written in C and previously used PyX as its output engine, hence the name.
Personally I would have named a new GNU plotting package "powder". gun powder plot, get it, har har.
Thanks for the pointer to pyxplot. It does look very impressive!
ReplyDeleteSlightly OT but, I like thw way R plots
ReplyDeleteI'm not nearly as adept at gnuplot as you are. However, I am willing to learn. That being said, if I am going to devote any time to this, I want to be sure that I've picked the best tool. On that note, there is also the python based matplotlib.
ReplyDeleteHere is a gallery:
http://matplotlib.sourceforge.net/gallery.html
It looks very nice. I especially like their 3d graphs. The x and y grid lines extend onto the z axis (so that the xy-plane is not the only one with a crossed grid). My question for you is, would you be able to replicate a graph like this in gnuplot:
http://matplotlib.sourceforge.net/examples/mplot3d/contour3d_demo3.html
In fact, trying to replicate some of the other graphs on that site would make for some good future topics on your blog.
Thanks!
Hello Karl,
ReplyDelete3/4 of that graph is easily reproduced in gnuplot, and the remaining 1/4 is also easy, if you are allowed to use a gawk script or something to "rotate" your data file. I will write it up next week.
Cheers,
Zoltán
Thank you Zoltán,
ReplyDeleteAt your own pace, would you also be able to replicate a polar graph like this in gnuplot:
http://matplotlib.sourceforge.net/examples/pylab_examples/polar_bar.html
In asking these questions, my only goal is to have peace of mind in knowing that if I learn gnuplot well, I will be able to reproduce almost anything.
I'm actually using Perl in my work. The concerns you raised about not being able to do data analysis in gnuplot are (in my opinion) a bit unfair. Ultimately, no matter what you add to gnuplot, it will never really be as powerful or general purpose as Perl or Python. You will always have to fall back to those languages for any 'serious' work.
Anyhow, I went through the matplotlib gallery and the 3-d and polar graphs are the only ones that gave me pause. But perhaps you can find others.
Thanks again,
Karl
Greetings Karl,
ReplyDeleteI haven't had too much time recently, so I couldn't live up to my promise about the plots. I will try to do that soon. As for your second question, there is a recent patch to gnuplot, with which you can plot arcs based on numbers in a file. I believe, you could use that to generate the polar plot that you linked to.
Cheers,
ZOltán
Hi there,
ReplyDeleteNew to your blog. I am interested in using gnuplot to generates a vector plot. do you have any example of such kind of application?
I've just tried pxyplot and it's nice. I like the output as opposed to the terminal, and the latex looks. But since I do lots of multiplots, it doesn't take as many options as gnuplot does.
ReplyDeleteIn any case, I'm really looking for a script or program that would let me choose element [n] to use when plotting with plot "file" using 1:4, so that I can divide all the elements of column 4 by its value at t=0. I've tried plot "file" using 1:($4/$4[0]) but it doesn't work, and searched everywhere and it seems you either do a script that calls awk or you divide by the value by hand, but that's not ideal when you have several data files to plot...
Hi Kamil,
ReplyDeleteYou can look at a post in http://gnuplot-tricks.blogspot.com/2010/01/further-new-features-in-gnuplot-44.html , or gnuplot's demo site, http://gnuplot.sourceforge.net/demo_4.4/vector.html .
Cheers,
Zoltán
Hi Mariangels,
ReplyDeleteIt is not quite clear, whether your question relates to gnuplot, or pyxplot. In the first case, you could do the following: First, you have to determine, what was the zeroth element in the column. You can achieve this by plotting only that element, and then determining the max/min of the plot range. I have used this trick quite a few times on this blog. So, in a script, this could look like this
plot 'foo' u 1:4 every ::0::0
zeroth_y = GPVAL_DATA_Y_MIN
plot 'foo' u 1:($4/zeroth_y)
If you use gnuplot 4.4, you can use the tricks in http://gnuplot-tricks.blogspot.com/2010/01/further-new-features-in-gnuplot-44.html to determine the value of the first element of the plot. Basically, you just have to define a function
f(x) = (a=x, 1/0)
plot 'foo' u 1:(f($4)) every ::0::0, 'foo' u 1:($4/a) w l
You only have to watch out for cases, when the zeroth element is zero.
If the question was about pyxplot, you could see the post on using macros.
I hope this helps,
Zoltán
Nem gondoltam volna, hogy egy kis gnuplotra keresgélés közben meglepetés ér, de tévedtem :-)
ReplyDeleteInformative article, precisely what I wanted. ppi reclaim
ReplyDeleteYour website is terribly informative and your articles are wonderful. cash advance payday loan
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteVery nice blog, Thanks for sharing great article.
ReplyDeleteYou are providing wonderful information, it is very useful to us.
Thank you.
For more information about: Managed Services vs Outsourcing