[Matplotlib-users] Newbie: How to control space between sets of bars in bar chart
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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Mac OS X 10.6 dmg install (Tim Gray)
I have followed these instructions to (almost ) the letter. Only difference is that python was already installed at /Library/Frameworks/Python.framework/Versions/2.6/bin/python I also re-installed numpy. Still no good with always the same problem - the absence of numpy.core.ma Any suggestions? Christopher >>> from pylab import randn, hist /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/__init__.py:62: DeprecationWarning: the md5 module is deprecated; use hashlib instead import md5, os, re, shutil, sys, warnings /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pytz/tzinfo.py:5: DeprecationWarning: the sets module is deprecated from sets import Set /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/__init__.py:606: UserWarning: Bad val "MacOSX" on line #31 "backend : MacOSX " in file "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/mpl-data/matplotlibrc" Unrecognized backend string "macosx": valid strings are ['Cairo', 'GD', 'CocoaAgg', 'GDK', 'PS', 'GTKAgg', 'GTK', 'Paint', 'QtAgg', 'Template', 'Agg2', 'Aqt', 'FltkAgg', 'TkAgg', 'WX', 'Qt4Agg', 'EMF', 'Agg', 'SVG', 'GTKCairo', 'WXAgg', 'Pdf'] "%s"\n\t%s' % (val, cnt, line, fname, msg)) Traceback (most recent call last): File "", line 1, in File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pylab.py", line 1, in from matplotlib.pylab import * File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/pylab.py", line 206, in from matplotlib.numerix import npyma as ma File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/numerix/__init__.py", line 166, in __import__('ma', g, l) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/numerix/ma/__init__.py", line 16, in from numpy.core.ma import * ImportError: No module named ma On 25 Jun 2010, at 01:58, Adam J Richards wrote: > Hi Tim, > > From what I gather you are trying to install everything from source the > trying to install via the dmg. I did a fresh install of python, > matplotlib and a number of other packages today (on 10.6) and maybe it > would be helpful to see how to install from source. When installing > Python, be sure to use --enable-framework. I used a /usr/local prefix > though this may be somewhere else for you. > > $ wget http://www.python.org/ftp/python/2.6.5/Python-2.6.5.tar.bz2 > $ tar -jxvf Python-2.6.5.tar.bz2 > $ cd Python-2.6.5 > $ ./configure --prefix=/usr/local --enable-framework > $ make > $ make install > > It appears that you have already installed numpy and so you would also > need the following: > > dateutils > $ sudo wget > http://labix.org/download/python-dateutil/python-dateutil-1.5.tar.gz > $ sudo tar xzf python-dateutil-1.5.tar.gz > $ cd python-dateutil-1.5 > $ sudo /usr/local/bin/python setup.py install > > freetype > $ > http://download.savannah.gnu.org/releases-noredirect/freetype/freetype-2.3.12.tar.gz > $ sudo tar xzf freetype-2.3.12.tar.gz > $ cd freetype-2.3.12 > $ sudo ./configure --prefix=/usr/local > $ sudo make > $ sudo make install > > libpng > $ sudo wget > http://sourceforge.net/projects/libpng/files/01-libpng-master/1.4.2/libpng-1.4.2.tar.gz/download > $ sudo tar xzf libpng-1.4.2.tar.gz > $ cd libpng-1.4.2 > $ sudo ./configure --prefix=/usr/local > $ sudo make > $ sudo make install > > pkconfig > $ sudo wget http://pkgconfig.freedesktop.org/releases/pkg-config-0.22.tar.gz > $ sudo tar xzf pkg-config-0.22.tar.gz > $ cd pkg-config-0.22 > $ sudo ./configure --prefix=/usr/local > $ sudo make > $ sudo make install > > Finally, you should be able to install matplotlib from source using, > $ sudo wget > http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-0.99.3/matplotlib-0.99.3.tar.gz/download > $ sudo tar xzf matplotlib-0.99.3.tar.gz > $ cd matplotlib-0.99.3 > $ sudo /usr/local/bin/python setup.py build > $ sudo /usr/local/bin/python setup.py install_* > *_ > Hopefully this helps. > > -Adam Richards > > Duke University > > -- > ThinkGeek and WIRED's GeekDad team up for the Ultimate > GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the > lucky parental unit. See the prize list and enter to win: > http://p.sf.net/sfu/thinkgeek-promo > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list
[Matplotlib-users] most recent install instruction for Mac OS
Can someone point me to up to date installation instructions for Mac OS (10.6.4, python 2.6.4)? Every route I pursue hits a dead end. - if I install from dmg files on the matplotlib, it is not visible to my python installation (I think it installs to the OSX native python). - if I install via easy_install or pip, then I get an error (previously emailed about) saying that numpy is incorrectly installed (Numpy tests pass) - if I try to follow the instructions on http://blog.hyperjeff.net/?p=160, I get errors such as: --- tar: Unrecognized archive format: Inappropriate file type or format tar: Error exit delayed from previous errors. make: *** [zlib] Error 1 --- Ages ago I successfully installed on my laptop but I do not seem to be able to repeat the feat on my desktop. Any help appreciated. Christopher -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] installation problems
On an iMac running 10.6.3, python 2.6.4 I have installed numpy and then matplotlib using 'pip'. The message in both cases was that the install was successful. 'import matplotlib' does not cause error messages. 'from pylab import randn, hist' gets a traceback with the message "ImportError: No module named ma" How do I get matplotlib to work? Thank you for any help. Christopher -- >>> from pylab import randn, hist /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/__init__.py:62: DeprecationWarning: the md5 module is deprecated; use hashlib instead import md5, os, re, shutil, sys, warnings /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pytz/tzinfo.py:5: DeprecationWarning: the sets module is deprecated from sets import Set Traceback (most recent call last): File "", line 1, in File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pylab.py", line 1, in from matplotlib.pylab import * File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/pylab.py", line 206, in from matplotlib.numerix import npyma as ma File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/numerix/__init__.py", line 166, in __import__('ma', g, l) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/numerix/ma/__init__.py", line 16, in from numpy.core.ma import * ImportError: No module named ma -- -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users