jump to navigation

A Comparison of the Plotting Softwares May 23, 2009

Posted by keithkchan in Whatever.
trackback

We need to plot some graphs from time to time. A good plotting tool is very important, in particular when you are going to put some graphs in the paper.

There are many plotting softwares available. However, I am a fan of the open software, and try my best not to use the commercial softwares, like Matlab and Origin, in plotting. Besides saving money, I admire the cause of open softwares. So far I can limit myself to using only open softwares happily (except Mathematica). So I will only talk about the open softwares only.

So far, I only need to plot not-so-fancy 2D graphs. I have tried several free plotting softwares, including xmgr, gnuplot and matplotlib.

xmgr is a graphical (GUI) plotting tool. Since it is GUI, it is relatively easy to start with. The quality is also good, as far as I remember. For those who used to use GUI, this is a good choice. But somehow I stop using it because it is not installed on the Linux system here at NYU. (Is it xmgr less popular than two other plotting tools? Is it not a routine part of the Linux distribution?)

Both gnuplot and matplotlib are script plotting tools. I think it is harder to begin with, in particular for people still live in the Windows world. If you use Linux or Mac, you probably are familiar with terminal and command-line approach already. I used to use Windows, and I found it pretty hard to accept the command-line softwares at that time. After quitting Windows, I am quite comfortable with scripts now. Of course, you don’t type the scripts every time. The first plot may be painful and time-consuming as you need to find out the appropriate commands to polish your graph. The second plot is going to be similar so you just need to copy from your old scripts. In the long run, the time required should be similar to, if not less than, the GUI plotting tool. I believe that the real master would use the scripts.

gnuplot is a sole plotting tool. The basic commands are easy to find online. I have been using it for some time. However, I (and some of my colleagues) find that the graphs from gnuplot still fall short of the publishing standard. Below I show the same data plotted using gnuplot and matplotlib respectively. Which one looks nicer?
gnuplot
matplotlib

I find the second one looks better, and it is plotted by matplotlib. If you think otherwise, I have nothing to say. matplotlib starts its life as a mimick of matlab, and it is a library in python. As you may know, python is a rather popular scripting language. To use it you have to import the matplotlib library in python. However to install the library may not be so easy, depending on your system. If you use Windows or Mac, you can install it easily using the Enthought Python Distribution, which is free for educational purpose. Certainly I satisfy this condition. I heard that installing it on Linux is pretty tricky. On one hand since it is just a library in python, you need to know the language python a little bit also, the potential barrier to overcome is higher than that for gnuplot. For example, I need to plot some graph using the columns of data in an ASCII file, I find it ridiculously complicated to do. It took me quite some time to google how to do it. On the other hand, as it is just a library in python, learning how to plot a graph using matplotlib you in fact have also started learning the python language. Isn’t it one stone two birds?

So what’s the conclusion? Which one is better? There is no conclusion. It is up to you to decide. I will use both gnuplot and matplotlib whenver convenient.

About these ads

Comments»

1. Zoltán - May 29, 2009

I think, your judgement on gnuplot is not quite fair: I can produce your second graph with gnuplot. What happened here is that you simply plot something in gnuplot, but didn’t specify the font size/type, position of the axis labels and so on, and then it’s no wonder that that plot is not so appealing. It is not that I have anything against matplotlib (in fact, I have tried that out myself, and it’s pretty cool), but we are not comparing apples to apples here.
Cheers,

2. keithkchan - June 1, 2009

Zoltan
Yes, I did not adjust the parameters in gnuplot plot, so that plot may be biased in this sense. But after adjusting it, it still looks less appealing than that from matplotlib, at least to my eyes.
Keith

3. sjoert - June 24, 2009

What about putting latex to the axis labels? (e.g. \chi^2). Can these guys do that? I know IDL can, but I won’t recommend anybody using IDL…

4. keithkchan - June 24, 2009

Sjoert
As far as I know Gnuplot allow you to make some common symbols, like Greek letter and super/sub-script, but relatively limited. But Matplotlib allow you to use Latex to type.
Keith


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: