Thursday, 26 August 2010

A small (or big) diversion

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

101 comments:

  1. For someone so proficient with gnuplot it's impressive to see you're open to alternatives.

    I'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.

    ReplyDelete
    Replies
    1. i habitually read your posts and they are very informative and helpful for me and as i glimpse not only for me. good job friend:)
      http://www.escort-hk.net/.

      Delete
  2. Thanks for the pointer to pyxplot. It does look very impressive!

    ReplyDelete
  3. Slightly OT but, I like thw way R plots

    ReplyDelete
  4. I'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.

    Here 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!

    ReplyDelete
  5. Hello Karl,

    3/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

    ReplyDelete
  6. Thank you Zoltán,

    At 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

    ReplyDelete
  7. Greetings Karl,

    I 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

    ReplyDelete
  8. Hi there,

    New to your blog. I am interested in using gnuplot to generates a vector plot. do you have any example of such kind of application?

    ReplyDelete
  9. 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.

    In 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...

    ReplyDelete
  10. Hi Kamil,

    You 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

    ReplyDelete
  11. Hi Mariangels,

    It 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

    ReplyDelete
  12. Nem gondoltam volna, hogy egy kis gnuplotra keresgélés közben meglepetés ér, de tévedtem :-)

    ReplyDelete
  13. Hi guys, when I am actually willing of reading these blog post to be updated regularly. It offers fastidious stuff.
    Read More about RLI Mola

    ReplyDelete
  14. I am certain this article has touched all the web visitors; it’s very extremely lovely script. Hongen 88 Tips And Tricks

    ReplyDelete
  15. I continuously continue coming to your website once more simply in case you have posted new contents. Relationship Advice by Radio SC

    ReplyDelete
  16. The stuff written in the blogs have allured me!!!
    Look for Forum Barcelos Here

    ReplyDelete
  17. I Love your articles guys keep it up.
    ppi claim

    ReplyDelete
  18. Great blog you people have made here on this blog site, I will absolutely appreciate your work.
    accident compensation

    ReplyDelete
  19. Informative article, precisely what I wanted. ppi reclaim

    ReplyDelete
  20. Your website is terribly informative and your articles are wonderful. cash advance payday loan

    ReplyDelete
  21. These are truly amongst the wonderful informative blogs. list of android phones

    ReplyDelete
  22. Your thing is shows latent, m gona add this to my bookmarks.
    Android Applications

    ReplyDelete
  23. That’s a great site you folks have been carrying out there.
    Click Sce Expo Link

    ReplyDelete
  24. Info is out of this world, I would bang to see more from your writers.

    Post Wand Light Relationships

    ReplyDelete
  25. I enjoy to translate and revalue your transmute.

    Paladin Soil Homepage

    ReplyDelete
  26. Your articles pee comprehensive signified out of apiece theme.
    Good Relationship With Sheritra

    ReplyDelete
  27. Your computer is rattling instructive and your articles are wonderful.
    Advice by SSE 520

    ReplyDelete
  28. Your articles are very well written and unique.
    ppi compensation

    ReplyDelete
  29. I'm planar for your article writings and contents fortunately.
    PPI Claim

    ReplyDelete
  30. Your site is very informative and your articles are wonderful.
    Where Wiki Relationships

    ReplyDelete
  31. I was searching for decisive information on this topic. The information you have provided in the blog is really important.
    More about SDJN 16Z

    ReplyDelete
  32. Marvelous work pals, I love reading your articles.
    Discover Chalkel

    ReplyDelete
  33. I have been intelligent for hours and I haven't gone through such awesome stuff.
    Tips by Global Oceans Conference

    ReplyDelete
  34. The individuals not reading your blogs stuff are missing out much qualitative contents.
    Forum E-Democratie Relationship Tips

    ReplyDelete
  35. The vital information in this blogs has allured me.easy root android

    ReplyDelete
  36. The stuff written in the blogs have allured me!!!
    auto insurance

    ReplyDelete
  37. The stuff in this blog is in not only incredible but also providing the great knowledge to the people.
    piratage facebook

    ReplyDelete
  38. These are the great blogs; I assure you that I really enjoyed a lot in reading. download android applications

    ReplyDelete
  39. Superb way of explaining, and great blog to get wonderful information. great american business products

    ReplyDelete
  40. Now this is in actual fact cooperative. It’s very openhanded of you to share this with us. flashback counter

    ReplyDelete
  41. Your work is totally enthusiastic and informative.
    social media infographics

    ReplyDelete
  42. Every day I visit a number of blog sites to see content, however this offers quality based content.
    infographic design

    ReplyDelete
  43. Your articles are actually inclusive signified out of respectively theme.
    good infographics

    ReplyDelete
  44. http://leloveimage.blogspot.com/2013/01/she-knows.html?showComment=1360234689779#c8179311280452900853

    ReplyDelete
  45. You people have actually provided the best blogs that are easy to understand for the folks. infographic design

    ReplyDelete
  46. The information you have given in the blog really marvelous and more interesting.automobilecom

    ReplyDelete
  47. You have shared the best blog. This is what I really need immediately.
    payday loans oregon

    ReplyDelete
  48. Your work is totally enthusiastic and informative.
    whole life insurance quotes

    ReplyDelete
  49. These are actually wonderful some ideas in the blog. You have touched good quality points here. In whatever way continue writing. social media infographics

    ReplyDelete
  50. Hi guys, when I am actually willing of reading these blog post to be updated regularly. It offers fastidious stuff.infographics design

    ReplyDelete
  51. Your blogs and its stuff magnetize me to return again n again.
    blood sugar levels chart

    ReplyDelete
  52. Well, it’s a nice one, I have been looking for. Thanks for sharing such informative stuff.
    life insurance rates

    ReplyDelete
  53. congratulations guys, quality information you have given!!! car insurance quotes

    ReplyDelete
  54. It's offensively easy to seek out any matter on web as compared to books, as I found this text at this website.
    Read Full Report

    ReplyDelete
  55. That’s a nice site you people are carrying out there.
    free tutor online

    ReplyDelete
  56. Personally I think overjoyed I discovered the blogs.magnettavle

    ReplyDelete
  57. I thought haven’t read such distinctive material anywhere else on-line.
    http://www.SelfDirectedGoldIRAPlan.com

    ReplyDelete
  58. The Info in the blog is out of this world, I so want to read more.
    search engine optimization edmonton

    ReplyDelete
  59. I have been dotty by reading your blog because it has a unique data.
    NY accident lawyer

    ReplyDelete
  60. This text may be value everyone’s attention. How will I learn more?
    payday loans online

    ReplyDelete
  61. I wanna thanks to a great extent for providing such informative and qualitative material therefore often.
    zip file password cracker

    ReplyDelete
  62. These articles and blogs are certainly sufficient for me personally for a day.car insurance rates

    ReplyDelete
  63. You have shared the best blog. This is what I really need immediately.
    car insurers

    ReplyDelete
  64. You guys abolish it real straightforward for all the oldsters out there.
    talktalk customer services

    ReplyDelete
  65. If you really desire to get such type of information, visit this blog quickly.
    paydayloans

    ReplyDelete
  66. I certainly appreciate your stuff provided in the blogs.
    click here

    ReplyDelete
  67. There is good collection of the articles with informative stuff.
    http://bonville.org/

    ReplyDelete
  68. congratulations guys, quality information you have given!!! english help online

    ReplyDelete
  69. If you really desire to get such type of information, visit this blog quickly.
    comment pirater un compte facebook

    ReplyDelete
  70. congratulations guys, quality information you have given!!! schaumburg bars

    ReplyDelete
  71. The information in this blog is extremely useful for the people. personal trainers Winnipeg

    ReplyDelete
  72. The information in this blog is extremely useful for the people. personal trainers Winnipeg

    ReplyDelete
  73. These are the great blogs; I assure you that I really enjoyed a lot in reading. comment pirater un compte facebook

    ReplyDelete
  74. I never ever read such type of info before this was really incredible. pirater un compte facebook

    ReplyDelete
  75. Nicest information!!! I'll be enchanted to greatly help due to what I've learnt from here. hacker un compte facebook

    ReplyDelete
  76. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me. bubblegum casting

    ReplyDelete
  77. It’s amazing in support of me to truly have a blog site, which will be valuable meant for my knowledge. Thanks admin.
    Mango producers in Pakistan

    ReplyDelete
  78. Your articles are purely enough for me. vietnam holiday

    ReplyDelete
  79. Hi to all, the blog has really the dreadful information I really enjoyed a lot.



    Gexton Apps

    ReplyDelete
  80. The complete blogs are really inconceivable and definitely everyone will share this information.
    anonymous browsing

    ReplyDelete
  81. Superb posts with lots of information!!! This is really the most miraculous blog site dude….
    visit us

    ReplyDelete
  82. It feels awe-inspiring to read such informative and distinctive articles on your websites.Visit Here

    ReplyDelete
  83. A great job you have already done. I’m really delighted to see your amazing work.
    winzip for mac free

    ReplyDelete
  84. I love all details that you give in your articles.
    vietnam visa

    ReplyDelete
  85. I never ever read such type of info before this was really incredible. replica watches

    ReplyDelete
  86. The quality of your articles and listing is really attractive.
    sewing kit

    ReplyDelete
  87. Your dazzling work has won my heart. I’ll come soon to your site with new hope.vietnam tour

    ReplyDelete
  88. I love really this blog site because it provides me the big deal of superb information.vietnam holiday

    ReplyDelete
  89. Nice to see your work!! It’s really helpful for me.vietnam travel

    ReplyDelete
  90. Amazing work pals, I really enjoy reading your interesting blogs.cheap no fax payday loan

    ReplyDelete
  91. Thanks friends, for providing such enlightening data.book a apartment marrakech

    ReplyDelete