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

Skip to content

Commit 6a4d343

Browse files
committed
added daisha patch
svn path=/trunk/matplotlib/; revision=1372
1 parent 698b8d6 commit 6a4d343

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+548
-111
lines changed

API_CHANGES

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
API CHANGES in matplotlib-0.81
22

3+
pylab and artist "set" functions renamed to setp to avoid clash with
4+
python2.4 built-in set. Current version will issue a deprecation
5+
warning which will be removed in future versions
6+
37
imshow interpolation arguments changes for advanced interpolation
48
schemes. See help imshow, particularly the interpolation,
59
filternorm and filterrad kwargs

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
New entries should be added at the top
22

3+
2005-05-26 Added Daisha text with dash patch -- see examples/dashtick.py
4+
35
2005-05-26 Moved backend_latex functionality into backend_ps. If
46
text.usetex=True, the PostScript backend will use LaTeX to
57
generate the .ps or .eps file. Ghostscript is required for

agg23/include/agg_math_stroke.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,8 @@ namespace agg
247247
dx2 = dy1;
248248
dy2 = dx1;
249249
}
250-
double dx = dx1 - dx2;
251-
double dy = dy1 - dy2;
252-
out_vertices.add(coord_type(v0.x - dx, v0.y + dy));
253-
out_vertices.add(coord_type(v0.x + dx, v0.y - dy));
250+
out_vertices.add(coord_type(v0.x - dx1 - dx2, v0.y + dy1 - dy2));
251+
out_vertices.add(coord_type(v0.x + dx1 - dx2, v0.y - dy1 - dy2));
254252
}
255253
else
256254
{

examples/anscombe.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,27 @@ def fit(x):
2626
subplot(221)
2727
plot(x,y1,'ks', xfit, fit(xfit), 'r-', lw=2)
2828
axis([2,20,2,14])
29-
set(gca(), xticklabels=[], yticks=(4,8,12), xticks=(0,10,20))
29+
setp(gca(), xticklabels=[], yticks=(4,8,12), xticks=(0,10,20))
3030
text(3,12, 'I', fontsize=20)
3131

3232
subplot(222)
3333
plot(x,y2,'ks', xfit, fit(xfit), 'r-', lw=2)
3434
axis([2,20,2,14])
35-
set(gca(), xticklabels=[], yticks=(4,8,12), yticklabels=[], xticks=(0,10,20))
35+
setp(gca(), xticklabels=[], yticks=(4,8,12), yticklabels=[], xticks=(0,10,20))
3636
text(3,12, 'II', fontsize=20)
3737

3838
subplot(223)
3939
plot(x,y3,'ks', xfit, fit(xfit), 'r-', lw=2)
4040
axis([2,20,2,14])
4141
text(3,12, 'IIII', fontsize=20)
42-
set(gca(), yticks=(4,8,12), xticks=(0,10,20))
42+
setp(gca(), yticks=(4,8,12), xticks=(0,10,20))
4343

4444
subplot(224)
4545

4646
xfit = array([amin(x4),amax(x4)])
4747
plot(x4,y4,'ks', xfit, fit(xfit), 'r-', lw=2)
4848
axis([2,20,2,14])
49-
set(gca(), yticklabels=[], yticks=(4,8,12), xticks=(0,10,20))
49+
setp(gca(), yticklabels=[], yticks=(4,8,12), xticks=(0,10,20))
5050
text(3,12, 'IV', fontsize=20)
5151

5252
#verify the stats

examples/arctest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ def f(t):
1111

1212

1313
l = plot(t1, f(t1), 'ro')
14-
set(l, 'markersize', 30)
15-
set(l, 'markerfacecolor', 'b')
14+
setp(l, 'markersize', 30)
15+
setp(l, 'markerfacecolor', 'b')
1616
#savefig('arctest', dpi=150)
1717
show()
1818

examples/axes_demo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
a = axes([.65, .6, .2, .2], axisbg='y')
2121
n, bins, patches = hist(s, 400, normed=1)
2222
title('Probability')
23-
set(a, xticks=[], yticks=[])
23+
setp(a, xticks=[], yticks=[])
2424

2525
# this is another inset axes over the main axes
2626
a = axes([0.2, 0.6, .2, .2], axisbg='y')
2727
plot(t[:len(r)], r)
2828
title('Impulse response')
29-
set(a, xlim=(0,.2), xticks=[], yticks=[])
29+
setp(a, xlim=(0,.2), xticks=[], yticks=[])
3030

3131
#savefig('../figures/axes_demo.eps')
3232
#savefig('../figures/axes_demo.png')

examples/axes_props.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
xticklabels = get(gca(), 'xticklabels')
1919
yticklabels = get(gca(), 'yticklabels')
2020

21-
set(xticklines, 'linewidth', 3)
22-
set(yticklines, 'linewidth', 3)
23-
set(xgridlines, 'linestyle', '-')
24-
set(ygridlines, 'linestyle', '-')
25-
set(yticklabels, 'color', 'r', fontsize='medium')
26-
set(xticklabels, 'color', 'r', fontsize='medium')
21+
setp(xticklines, 'linewidth', 3)
22+
setp(yticklines, 'linewidth', 3)
23+
setp(xgridlines, 'linestyle', '-')
24+
setp(ygridlines, 'linestyle', '-')
25+
setp(yticklabels, 'color', 'r', fontsize='medium')
26+
setp(xticklabels, 'color', 'r', fontsize='medium')
2727

2828
# keyword args are legal too
2929
#set(xticklabels, color='r', fontsize='medium')

examples/color_by_yvalue.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# use masked arrays to plot a line with different colors by y-value
2+
import matplotlib.numerix.ma as ma
3+
from matplotlib.numerix import logical_or
4+
from pylab import plot, show, arange, sin, pi
5+
6+
t = arange(0.0, 2.0, 0.01)
7+
s = sin(2*pi*t)
8+
9+
upper = 0.77
10+
lower = -0.77
11+
12+
13+
supper = ma.masked_where(s < upper, s)
14+
slower = ma.masked_where(s > lower, s)
15+
smiddle = ma.masked_where(logical_or(s<lower, s>upper), s)
16+
17+
plot(t, slower, 'r', t, smiddle, 'b', t, supper, 'g')
18+
show()

examples/contour_image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
contour(Z, levels, hold='on', colors = 'k', origin='image', extent=extent)
8888
axis(v)
8989
ylim = get(gca(), 'ylim')
90-
set(gca(), ylim=ylim[::-1])
90+
setp(gca(), ylim=ylim[::-1])
9191
title("Image, origin from rc, reversed y-axis")
9292

9393
#savefig('contour_image')

examples/dashtick.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Matplotlib xaxis label tweak
2+
3+
import sys
4+
import matplotlib
5+
from matplotlib import pylab, ticker
6+
7+
ROTATION=75
8+
DASHROTATION=75
9+
DASHBASE=10
10+
DASHLEN=35
11+
DASHSTAGGER=3
12+
FONTSIZE=6
13+
14+
def dashlen(step):
15+
return DASHBASE+(DASHLEN*(step%DASHSTAGGER))
16+
17+
def test_dashticklabel():
18+
pylab.clf()
19+
x = [0.0, 1.0, 1.1, 5.0, 5.1, 6.0]
20+
y = [1, 3, 2, 5, 1, 2]
21+
labels = ['foo', 'bar', 'baz', 'alpha', 'beta', 'gamma']
22+
locator = ticker.FixedLocator(x)
23+
formatter = ticker.FixedFormatter(labels)
24+
axis = pylab.axes([0.3, 0.3, 0.4, 0.4])
25+
axis.xaxis.set_major_locator(locator)
26+
axis.xaxis.set_major_formatter(formatter)
27+
axis.yaxis.set_major_locator(locator)
28+
axis.yaxis.set_major_formatter(formatter)
29+
for tick in axis.xaxis.get_major_ticks():
30+
tick.label2On = True
31+
for tick in axis.yaxis.get_major_ticks():
32+
tick.label2On = True
33+
step = 0
34+
for label in axis.get_xticklabels():
35+
pylab.set(label,
36+
rotation=ROTATION,
37+
dashlength=dashlen(step),
38+
dashrotation=DASHROTATION,
39+
fontsize=FONTSIZE,
40+
)
41+
step += 1
42+
step = 0
43+
for label in axis.get_yticklabels():
44+
pylab.set(label,
45+
rotation=90-ROTATION,
46+
dashlength=dashlen(step),
47+
dashrotation=90-DASHROTATION,
48+
fontsize=FONTSIZE,
49+
)
50+
step += 1
51+
pylab.xlabel('X Label')
52+
pylab.ylabel('Y Label')
53+
pylab.plot(x, y)
54+
axis.set_xlim((0.0, 6.0))
55+
axis.set_ylim((0.0, 6.0))
56+
pylab.savefig('dashticklabel')
57+
pylab.show()
58+
59+
if __name__ == '__main__':
60+
test_dashticklabel()

0 commit comments

Comments
 (0)