轻轻松松画柱状图(bar graph)

去年年底写一个paper的时候,需要画很多柱状图。大家都知道matlab是个很好的画图工具, 也能很容易的画bar graph通过bar命令。但是,一来它不是free的,二来,打开matlab实在是太慢。所以,我一般使用gnuplot来作图。但是, 我本人不太会用gnuplot直接画柱状图,也没有在网上找到比较好的例子或者tutorial。幸运的是,后来在网上找到MIT一个搞compiler 的博士Derek Bruening写的一个小程序,叫做bargraph.pl (under GPL), 专门用来画Clustered/Stacked Filled Bar Graph。只要机器上装了perl和gnuplot就可以使用这个script了(both Perl and Gnuplot are open source and free)。怎么用呢?最好的办法就是,把它网页上的例子弄下来,一改就搞定。可 以,轻易得画出各种各样的漂亮的bar graph。特推荐给正在或将要写paper, thesis, dissertation的同仁们使用, 尤其是使用latex的朋友(这个script可以直接产生eps或png)。

一个小tip: 在它的网页上的例子中,没有y坐标是log scale的。其实也是可以做到的:

就加一行: extraops=set logscale y

通过”extrapos”可以使用各种gnuplot的设置命令。

Enjoy。

Related posts

hi…
I don’t know how to do it..
I want to draw a Horizontal Bar Graph…
You said 就加一行: extraops=set logscale y.
他设置了x y轴内容啦已经,我怎样把x轴的东西转到y轴呢?
你能不能把你的小例子贴上来?
我对这个比较迷茫。。。。。。。。。。
谢谢

我还真不知道怎么画横着的柱状图。你可以发信问问作者。

我说的那个,是用来把y坐标设置为对数坐标的。

‘gnuplot’ is not recognized as an internal or external command,
operable program or batch file.
‘fig2dev’ is not recognized as an internal or external command,
operable program or batch file.

我总是找不了这两个文件,不知道在哪里放置的(我下载的是win版本的gnuplot)