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

Skip to content

Commit 2cc871f

Browse files
committed
fixed font and other scaling problems in gtk backend
svn path=/trunk/matplotlib/; revision=27
1 parent da1b171 commit 2cc871f

5 files changed

Lines changed: 32 additions & 6 deletions

File tree

CHANGELOG

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,22 @@
8282
2003-08-27
8383

8484
Fixed bugs i figure text with font override dictionairies and fig
85-
text that was placed outside the window bounding box
85+
text that was placed outside the window bounding box
86+
87+
2003-09-1 thru 2003-09-15
88+
89+
Added a postscript and a GD module backend
90+
91+
2003-09-16
92+
93+
Fixed font scaling and point scaling so circles, squares, etc on
94+
lines will scale with DPI as will fonts. Font scaling is not fully
95+
implemented on the gtk backend because I have not figured out how
96+
to scale fonts to arbitrary sizes with GTK
97+
98+
2003-09-17
99+
100+
Fixed figure text bug which crashed X windows on long figure text
101+
extending beyond display area. This was, I believe, due to the
102+
vestigial erase functionality that was no longer needed since I
103+
began rendering to a pixmap

examples/embedding_in_gtk.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import matplotlib.figure as mpl
1+
import matplotlib
2+
matplotlib.use('GTK')
3+
4+
from matplotlib.backends import Figure
5+
from matplotlib.axes import Subplot
26
import Numeric as numpy
37
import gtk
48

@@ -11,8 +15,8 @@
1115
win.add(vbox)
1216
vbox.show()
1317

14-
f = mpl.Figure()
15-
a = mpl.Subplot(111)
18+
f = Figure(figsize=(5,4), dpi=100)
19+
a = Subplot(111)
1620
t = numpy.arange(0.0,3.0,0.01)
1721
s = numpy.sin(2*numpy.pi*t)
1822

examples/figtext.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ def f(t):
1414
plot(t1, f(t1), 'bo', t2, f(t2), 'k')
1515
title('subplot 1')
1616
ylabel('Damped oscillation')
17-
t = gcf().text(0.5, 0.95, 'Figure Title: A really, really, really, really long figure title', fontsize=20)
17+
figtitle = 'Figure Title: this is really, really, silly, and really, really long'
18+
t = gcf().text(0.9, 0.95, figtitle,
19+
horizontalalignment='center', fontsize=20,)
1820

1921

2022
subplot(122)
@@ -23,5 +25,6 @@ def f(t):
2325
title('subplot 2')
2426
ylabel('Undamped')
2527

28+
savefig('figtext', dpi=150)
2629
show()
2730

examples/histogram_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@
1818
title('Histogram of IQ: mu=100, sigma=15')
1919

2020

21-
savefig('histogram', dpi=300)
21+
savefig('histogram_demo', dpi=150)
2222
show()

examples/text_themes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ def f(t):
1919
xlabel('time (s)', font)
2020
ylabel('voltage (mV)', font)
2121

22+
savefig('text_themes', dpi=150)
2223
show()

0 commit comments

Comments
 (0)