2

I want to use python Gnuplot to plot a bar graph; however, I didn't find the specific manual or instruction to do that, and thanks for any suggestions.

I was doing:

graph = Gnuplot.Gnuplot(debug=1)
graph.plot(Gnuplot.Data(exp_data[0],exp_data[1],title='exp')
2

1 Answer 1

3

The trick with Gnuplot is that you can use the same instructions you use on the gnuplot shell. So you only need to check a gnuplot demo for bar charts to know how to do things:

>>> from Gnuplot import Gnuplot
>>> gp = Gnuplot()
>>> gp('set style data histograms')
>>> gp('set style fill solid 1.0 border -1')
>>> gp.plot([8,2,6,4,5])

enter image description here

Although in gnuplot-py you have methods to set plot parameters, this text approach allows you to reach the full power of gnuplot and in cases when you only have documentation for gnuplot (that is good and extense, btw) it is a straightforward way of getting things done.

As others commented, the general advice is to have a look at matplotlib. Not long ago, I often prefered gnuplot to plot 3D graphics because its speed. However matplotlib plot3d is currently behaving very well for that purpose.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.