Skip to content

Commit 360a304

Browse files
committed
added some fill demos
svn path=/trunk/matplotlib/; revision=545
1 parent 926b070 commit 360a304

File tree

6 files changed

+82
-22
lines changed

6 files changed

+82
-22
lines changed

API_CHANGES

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,45 @@
1+
API CHANGES in matplotlib-0.63
2+
3+
Dates are now represented internally as float days since 0001-01-01,
4+
UTC.
5+
6+
All date tickers and formatters are now in matplotlib.dates, rather
7+
than matplotlib.tickers
8+
9+
converters have been abolished from all functions and classes.
10+
num2date and date2num are now the converter functions for all date
11+
plots
12+
13+
Most of the date tick locators have a different meaning in their
14+
constructors. In the prior implementation, the first argument was a
15+
base and multiples of the base were ticked. Eg
16+
17+
HourLocator(5) # old: tick every 5 minutes
18+
19+
In the new implementation, the explicit points you want to tick are
20+
provided as a number or sequence
21+
22+
HourLocator(range(0,5,61)) # new: tick every 5 minutes
23+
24+
This gives much greater flexibility. I have tried to make the
25+
default constructors (no args) behave similarly, where possible.
26+
27+
Note that YearLocator still works under the base/multiple scheme.
28+
The difference between the YearLocator and the other locators is
29+
that years are not recurrent.
30+
31+
32+
Financial functions:
33+
34+
matplotlib.finance.quotes_historical_yahoo(ticker, date1, date2)
35+
36+
date1, date2 are now datetime instances. Return value is a list
37+
of quotes where the quote time is a float - days since gregorian
38+
start, as returned by date2num
39+
40+
See examples/finance_demo.py for example usage of new API
41+
42+
143
API CHANGES in matplotlib-0.61
244

345
canvas.connect is now deprecated for event handling. use

INSTALL

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,13 @@ COMPILING
4545
/some/path/include/somheader.h, put /some/path in the basedir list
4646
for your platform.
4747

48-
Note, matplotlib works with with Numeric or numarray, but it is
49-
important that you set NUMERIX in setup.py to the array package you
50-
typically use, for efficiency reasons. For performace, it is
51-
critical that the numerix settings in setup.py and in your
52-
.matplotlibrc file are the same, and are the same as the array
53-
package you typicaly use.
48+
matplotlib works with with Numeric or numarray. At compile time,
49+
setup.py will look for both packages and compile the appropriate
50+
extensions into matplotlib. At runtime, the correct extension code
51+
will be chosen based on your numerix setting in matplotlibrc. If
52+
you want to be able to use either Numeric or numarray efficiently
53+
with matplotlib, it is important that you have *both* present and in
54+
your PYTHONPATH when you compile matplotlib.
5455

5556
Note that if you install matplotlib anywhere other than the default
5657
location, you will need to set the MATPLOTLIBDATA environment

examples/date_demo2.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,5 @@
4040
set(labels, rotation=45)
4141

4242
grid(True)
43+
savefig('date_demo2')
4344
show()

examples/fill_between.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
11
from matplotlib.matlab import *
2-
from matplotlib.patches import Polygon
32

4-
def fill_between(ax, x, y1, y2, **kwargs):
5-
# add x,y2 in reverse order
6-
verts = zip(x,y1) + [(x[i], y2[i]) for i in range(len(x)-1,-1,-1)]
7-
poly = Polygon(verts, **kwargs)
8-
ax.add_patch(poly)
9-
ax.autoscale_view()
10-
return poly
3+
x1 = arange(0, 2, 0.01)
4+
y1 = sin(2*pi*x1)
5+
y2 = sin(4*pi*x1) + 2
116

12-
x = arange(0, 2, 0.01)
13-
y1 = sin(2*pi*x)
14-
y2 = sin(4*pi*x) + 2
15-
ax = gca()
16-
17-
p = fill_between(ax, x, y1, y2, facecolor='g')
18-
p.set_alpha(0.5)
7+
# reverse x and y2 so the polygon fills in order
8+
x = concatenate( (x1,x1[::-1]) )
9+
y = concatenate( (y1,y2[::-1]) )
10+
11+
p = fill(x, y, facecolor='g')
12+
set(p, alpha=0.5)
1913
show()
2014

examples/fill_spiral.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from matplotlib.matlab import *
2+
3+
theta = arange(0,8*pi,0.1)
4+
a=1
5+
b=.2
6+
7+
for dt in arange(0,2*pi,pi/2.0):
8+
9+
x = a*cos( theta+dt )*exp(b*theta)
10+
y = a*sin( theta+dt )*exp(b*theta)
11+
12+
dt = dt+pi/4.0
13+
14+
x2 = a*cos( theta+dt )*exp(b*theta)
15+
y2 = a*sin( theta+dt )*exp(b*theta)
16+
17+
xf = concatenate( (x,x2[::-1]) )
18+
yf = concatenate( (y,y2[::-1]) )
19+
20+
p1=fill(xf,yf)
21+
22+
show()

lib/matplotlib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
the exception of those in mlab.py provided by matplotlib.
114114
"""
115115

116-
__version__ = '0.63.0a'
116+
__version__ = '0.63.0'
117117
__revision__ = '$Revision$'
118118
__date__ = '$Date$'
119119

0 commit comments

Comments
 (0)