Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 196541b

Browse files
committed
Merged revisions 7323-7326,7328-7331,7334-7337,7343 via svnmerge from
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_99_maint ........ r7323 | jdh2358 | 2009-07-31 10:32:11 -0500 (Fri, 31 Jul 2009) | 2 lines apply sf patches 2830233 and 2823885 for osx setup and 64 bit; thanks Michiel ........ r7324 | jdh2358 | 2009-07-31 10:39:30 -0500 (Fri, 31 Jul 2009) | 1 line revert setupext.py patch for osx; breaks my osx test build ........ r7325 | jdh2358 | 2009-07-31 10:52:19 -0500 (Fri, 31 Jul 2009) | 1 line added miktex win32 patch from sf patch 2820194 ........ r7326 | jdh2358 | 2009-07-31 13:11:50 -0500 (Fri, 31 Jul 2009) | 1 line update the makefile for win32 build ........ r7328 | jdh2358 | 2009-08-01 12:37:26 -0500 (Sat, 01 Aug 2009) | 1 line Applied Michiel's sf patch 2823885 to remove the /usr/X11R6 dirs from darwin ........ r7329 | jdh2358 | 2009-08-01 14:11:58 -0500 (Sat, 01 Aug 2009) | 1 line some fixes for the binary builds ........ r7330 | jdh2358 | 2009-08-01 14:27:43 -0500 (Sat, 01 Aug 2009) | 1 line more fixes for osx ........ r7331 | jdh2358 | 2009-08-01 14:34:05 -0500 (Sat, 01 Aug 2009) | 1 line update the readme with build requirements ........ r7334 | jdh2358 | 2009-08-03 11:38:25 -0500 (Mon, 03 Aug 2009) | 1 line handled sf bugs 2831556 and 2830525; better bar error messages and backend driver configs ........ r7335 | jdh2358 | 2009-08-03 12:19:42 -0500 (Mon, 03 Aug 2009) | 1 line added two examples from Josh Hemann ........ r7336 | jdh2358 | 2009-08-03 12:40:17 -0500 (Mon, 03 Aug 2009) | 1 line fixed rec2csv win32 file handle bug from sf patch 2831018 ........ r7337 | jdh2358 | 2009-08-03 14:31:05 -0500 (Mon, 03 Aug 2009) | 1 line removed a couple of cases of mlab.load ........ r7343 | jdh2358 | 2009-08-04 06:50:09 -0500 (Tue, 04 Aug 2009) | 1 line applied sf patch 2815064 (middle button events for wx) and patch 2818092 (resize events for wx) ........ svn path=/trunk/matplotlib/; revision=7346
2 parents fe55936 + 520f85a commit 196541b

19 files changed

Lines changed: 818 additions & 188 deletions

File tree

doc/_templates/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44

55
{% block body %}
6-
<h1>Welcome</h1>
6+
<h1>mpl</h1>
77

88
<p>matplotlib is a python 2D plotting library which produces
99
publication quality figures in a variety of hardcopy formats and

doc/_templates/indexsidebar.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ <h3>News</h3>
44
<p>Please <a href="http://sourceforge.net/project/project_donations.php?group_id=80706">donate</a>
55
to support matplotlib development.</p>
66

7+
<p>A release candidate rc1 of matplotlib-0.99.0 is <a href="http://drop.io/xortel1#">available</a> for testing. Please post any bugs to the <a href="http://sourceforge.net/tracker2/?group_id=80706">tracker</a>
8+
</p>
79

810
<p>Watch a <a href="http://videolectures.net/mloss08_hunter_mat">video lecture</a> about matplotlib presented at <a href="http://videolectures.net/mloss08_whistler">NIPS 08 Workshop</a> <i>Machine Learning Open Source Software</i></a>.
911
</p>
1012

1113
<h3>Download</h3>
14+
1215
<p>Current version: <b>{{ version }}</b></p>
1316

1417

doc/api/spine_api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ matplotlib spine
44

55

66
:mod:`matplotlib.spine`
7-
======================
7+
========================
88

99
.. automodule:: matplotlib.spine
1010
:members:

doc/faq/installing_faq.rst

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,66 @@ official OS X version from `python.org
287287
<http://www.python.org/download/>`_.
288288

289289

290+
.. _install_osx_binaries:
291+
292+
Installing OSX binaries
293+
-----------------------
294+
295+
If you want to install matplotlib from one of the binary installers we
296+
build, you have two choices: a mpkg installer, which is a typical
297+
Installer.app, or an binary OSX egg, which you can install via
298+
setuptools easy_install.
299+
300+
The mkpg installer will have a "zip" extension, and will have a name
301+
like file:`matplotlib-0.99.0.rc1-py2.5-macosx10.5_mpkg.zip` depending on
302+
the python, matplotlib, and OSX versions. You need to unzip this file
303+
using either the "unzip" command on OSX, or simply double clicking on
304+
it to run StuffIt Expander. When you double click on the resultant
305+
mpkd directory, which will have a name like
306+
file:`matplotlib-0.99.0.rc1-py2.5-macosx10.5.mpkg`, it will run the
307+
Installer.app, prompt you for a password if you need system wide
308+
installation privileges, and install to a directory like
309+
file:`/Library/Python/2.5/site-packages/`, again depedending on your
310+
python version. This directory may not be in your python path, so you
311+
can test your installation with::
312+
313+
> python -c 'import matplotlib; print matplotlib.__version__, matplotlib.__file__'
314+
315+
If you get an error like::
316+
317+
Traceback (most recent call last):
318+
File "<string>", line 1, in <module>
319+
ImportError: No module named matplotlib
320+
321+
then you will need to set your PYTHONPATH, eg::
322+
323+
export PYTHONPATH=/Library/Python/2.5/site-packages:$PYTHONPATH
324+
325+
See also ref:`environment-variables`.
326+
290327
.. _easy-install-osx-egg:
291328

292-
easy_install from egg?
329+
easy_install from egg
293330
------------------------------
294331

332+
You can also us the eggs we build for OSX (see the `installation
333+
instructions
334+
<http://pypi.python.org/pypi/setuptools#cygwin-mac-os-x-linux-other>`_
335+
for easy_install if you do not have it on your system already). You
336+
can try::
337+
338+
> easy_install matplotlib
339+
340+
which should grab the latest egg from the sourceforge site, but the
341+
naming conventions for OSX eggs appear to be broken (see below) so
342+
there is no guarantee the right egg will be found. We recommend you
343+
download the latest egg from our `download site
344+
<http://sourceforge.net/projects/matplotlib/files/>`_ directly to your
345+
harddrive, and manually install it with
346+
347+
> easy_install --install-dir=~/dev/lib/python2.5/site-packages/ matplotlib-0.99.0.rc1-py2.5-macosx-10.5-i386.egg
348+
349+
295350
Some users have reported problems with the egg for 0.98 from the
296351
matplotlib download site, with ``easy_install``, getting an error::
297352

doc/pyplots/plotmap.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
# the data is interpolated to the native projection grid.
66
import os
77
from mpl_toolkits.basemap import Basemap, shiftgrid
8-
from pylab import title, colorbar, show, axes, cm, load, arange, figure, \
8+
import numpy as np
9+
10+
from pylab import title, colorbar, show, axes, cm, arange, figure, \
911
text
1012

1113
# read in topo data (on a regular lat/lon grid)
@@ -15,9 +17,9 @@
1517
if not os.path.exists(datadir):
1618
raise SystemExit('You need to download the data with svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/htdocs/screenshots/data/" and set the datadir variable in %s'%__file__)
1719

18-
topoin = load(os.path.join(datadir, 'etopo20data.gz'))
19-
lons = load(os.path.join(datadir, 'etopo20lons.gz'))
20-
lats = load(os.path.join(datadir, 'etopo20lats.gz'))
20+
topoin = np.loadtxt(os.path.join(datadir, 'etopo20data.gz'))
21+
lons = np.loadtxt(os.path.join(datadir, 'etopo20lons.gz'))
22+
lats = np.loadtxt(os.path.join(datadir, 'etopo20lats.gz'))
2123
# shift data so lons go from -180 to 180 instead of 20 to 380.
2224
topoin,lons = shiftgrid(180.,topoin,lons,start=False)
2325

doc/users/installing.rst

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,17 @@ configuration details for you, so you can get up and running quickly::
6363
And a *voila*, a figure pops up. But we are putting the cart ahead of
6464
the horse -- first we need to get matplotlib installed. We provide
6565
prebuilt binaries for OS X and Windows on the matplotlib `download
66-
<http://sourceforge.net/project/showfiles.php?group_id=80706>`_ page.
67-
Click on the latest release of the "matplotlib" package, choose your
68-
python version (2.4 or 2.5) and your platform (macosx or win32) and
69-
you should be good to go. If you have any problems, please check the
66+
<http://sourceforge.net/projects/matplotlib/files/>`_ page. Click on
67+
the latest release of the "matplotlib" package, choose your python
68+
version (2.4 or 2.5) and your platform (macosx or win32) and you
69+
should be good to go. If you have any problems, please check the
7070
:ref:`installing-faq`, google around a little bit, and post a question
7171
the `mailing list
7272
<http://sourceforge.net/project/showfiles.php?group_id=80706>`_.
7373

74+
Instructions for installing our OSX binaries are found in the FAQ
75+
ref:`install_osx_binaries`.
76+
7477
Note that when testing matplotlib installations from the interactive
7578
python console, there are some issues relating to user interface
7679
toolkits and interactive settings that are discussed in
@@ -114,7 +117,8 @@ Build requirements
114117
These are external packages which you will need to install before
115118
installing matplotlib. Windows users only need the first two (python
116119
and numpy) since the others are built into the matplotlib windows
117-
installers available for download at the sourceforge site.
120+
installers available for download at the sourceforge site. If you are
121+
building on OSX, see :ref:`build_osx`
118122

119123
:term:`python` 2.4 (or later but not python3)
120124
matplotlib requires python 2.4 or later (`download <http://www.python.org/download/>`__)
@@ -183,3 +187,19 @@ dateutil 1.1 or later
183187

184188

185189

190+
.. _build_osx:
191+
192+
Building on OSX
193+
==================
194+
195+
The build situation on OSX is complicated by the various places one
196+
can get the png and freetype requirements from (darwinports, fink,
197+
/usr/X11R6) and the different architectures (x86, ppc, universal) and
198+
the different OSX version (10.4 and 10.5). We recommend that you build
199+
the way we do for the OSX release: by grabbing the tarbar or svn
200+
repository, cd-ing into the release/osx dir, and following the
201+
instruction in the README. This directory has a Makefile which will
202+
automatically grab the zlib, png and freetype dependencies from the
203+
web, build them with the right flags to make universal libraries, and
204+
then build the matplotlib source and binary installers.
205+
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
"""
2+
Thanks Josh Hemann for the example
3+
4+
This examples comes from an application in which grade school gym
5+
teachers wanted to be able to show parents how their child did across
6+
a handful of fitness tests, and importantly, relative to how other
7+
children did. To extract the plotting code for demo purposes, we'll
8+
just make up some data for little Johnny Doe...
9+
10+
"""
11+
import numpy as np
12+
import matplotlib.pyplot as plt
13+
import pylab
14+
from matplotlib.patches import Polygon
15+
from matplotlib.ticker import MaxNLocator
16+
17+
18+
19+
student = 'Johnny Doe'
20+
grade = 2
21+
gender = 'boy'
22+
cohortSize = 62 #The number of other 2nd grade boys
23+
24+
numTests = 5
25+
testNames = ['Pacer Test', 'Flexed Arm\n Hang', 'Mile Run', 'Agility',
26+
'Push Ups']
27+
testMeta = ['laps', 'sec', 'min:sec', 'sec', '']
28+
scores = ['7', '48', '12:52', '17', '14']
29+
rankings = np.round(np.random.uniform(0, 1, numTests)*100, 0)
30+
31+
fig = plt.figure(figsize=(9,7))
32+
ax1 = fig.add_subplot(111)
33+
plt.subplots_adjust(left=0.115, right=0.88)
34+
fig.canvas.set_window_title('Eldorado K-8 Fitness Chart')
35+
pos = np.arange(numTests)+0.5 #Center bars on the Y-axis ticks
36+
rects = ax1.barh(pos, rankings, align='center', height=0.5, color='m')
37+
38+
ax1.axis([0,100,0,5])
39+
pylab.yticks(pos, testNames)
40+
ax1.set_title('Johnny Doe')
41+
plt.text(50, -0.5, 'Cohort Size: ' + str(cohortSize),
42+
horizontalalignment='center', size='small')
43+
44+
# Set the right-hand Y-axis ticks and labels and set X-axis tick marks at the
45+
# deciles
46+
ax2 = ax1.twinx()
47+
ax2.plot([100,100], [0, 5], 'white', alpha=0.1)
48+
ax2.xaxis.set_major_locator(MaxNLocator(11))
49+
xticks = pylab.setp(ax2, xticklabels=['0','10','20','30','40','50','60',
50+
'70',
51+
'80','90','100'])
52+
ax2.xaxis.grid(True, linestyle='--', which='major', color='grey',
53+
alpha=0.25)
54+
#Plot a solid vertical gridline to highlight the median position
55+
plt.plot([50,50], [0, 5], 'grey', alpha=0.25)
56+
57+
# Build up the score labels for the right Y-axis by first appending a carriage
58+
# return to each string and then tacking on the appropriate meta information
59+
# (i.e., 'laps' vs 'seconds'). We want the labels centered on the ticks, so if
60+
# there is no meta info (like for pushups) then don't add the carriage return to
61+
# the string
62+
63+
def withnew(i, scr):
64+
if testMeta[i] != '' : return '%s\n'%scr
65+
else: return scr
66+
scoreLabels = [withnew(i, scr) for i,scr in enumerate(scores)]
67+
scoreLabels = [i+j for i,j in zip(scoreLabels, testMeta)]
68+
pylab.yticks(pos, scoreLabels)
69+
ax2.set_ylabel('Test Scores')
70+
#Make list of numerical suffixes corresponding to position in a list
71+
# 0 1 2 3 4 5 6 7 8 9
72+
suffixes =['th', 'st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th']
73+
ax2.set_xlabel('Percentile Ranking Across ' + str(grade) + suffixes[grade] \
74+
+ ' Grade ' + gender.title() + 's')
75+
76+
# Lastly, write in the ranking inside each bar to aid in interpretation
77+
for rect in rects:
78+
# Rectangle widths are already integer-valued but are floating
79+
# type, so it helps to remove the trailing decimal point and 0 by
80+
# converting width to int type
81+
width = int(rect.get_width())
82+
83+
# Figure out what the last digit (width modulo 10) so we can add
84+
# the appropriate numerical suffix (e.g. 1st, 2nd, 3rd, etc)
85+
lastDigit = width % 10
86+
# Note that 11, 12, and 13 are special cases
87+
if (width == 11) or (width == 12) or (width == 13):
88+
suffix = 'th'
89+
else:
90+
suffix = suffixes[lastDigit]
91+
92+
rankStr = str(width) + suffix
93+
if (width < 5): # The bars aren't wide enough to print the ranking inside
94+
xloc = width + 1 # Shift the text to the right side of the right edge
95+
clr = 'black' # Black against white background
96+
align = 'left'
97+
else:
98+
xloc = 0.98*width # Shift the text to the left side of the right edge
99+
clr = 'white' # White on magenta
100+
align = 'right'
101+
102+
yloc = rect.get_y()+rect.get_height()/2.0 #Center the text vertically in the bar
103+
ax1.text(xloc, yloc, rankStr, horizontalalignment=align,
104+
verticalalignment='center', color=clr, weight='bold')
105+
106+
plt.show()
107+

0 commit comments

Comments
 (0)