My apologies in advance if this is obvious.
I have a bar chart with three sets of figures and I would like some space
between the three sets. I cannot seem to find anything in the manual or online
which explains how to separate sets of data.
I tried adding a blank (white bar) with 0 data and that did not work. When I
made the data non zero I got overlapping bars. Basically I want the US/EU/Japan
data slightly set apart. This is the default if I use a speadsheet package.
I must be doing something obviously wrong.
Thank you in advance for your help
Christopher
----------------
#!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
N = 3
_1971 = (120, 130, 70)
_2008 = (400, 370, 180)
_2011 = (350, 350, 140)
# _blank = (100,100,100)
ind = np.arange(N) # the x locations for the groups
width = 0.35 # the width of the bars
plt.subplot(111)
rects1 = plt.bar(ind, _1971, width, color='r')
rects2 = plt.bar(ind+width, _2008, width, color='y')
rects3 = plt.bar(ind+width+width, _2011, width, color='b')
# rects4 = plt.bar(ind+width+width+width, _blank, width, color='w')
plt.ylabel('Annual Expenditure ($bn)')
plt.title('Net Imports')
plt.xticks((ind+(width*1.5)), ('US', 'EU', 'Japan'))
plt.axes().yaxis.grid(True, linestyle='--', which='major', color='grey',
alpha=0.75) # add a grid to the subplot
plt.show()
# plt.savefig('oilbar.pdf')
----------------
------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users