Skip to content

Commit cc85685

Browse files
committed
multiple scales on same axes
svn path=/trunk/matplotlib/; revision=246
1 parent 6e6cf8f commit cc85685

File tree

5 files changed

+74
-6
lines changed

5 files changed

+74
-6
lines changed

CHANGELOG

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
New entries should be added at the top
22

3+
2004-04-17 Added support for two scales on the "same axes" with tick
4+
different ticking and labeling left right or top bottom.
5+
See examples/two_scales.py - JDH
6+
37
2004-04-17 Added default dirs as list rather than single dir in
48
setupext.py - JDH
59

610
2004-04-16 Fixed wx exception swallowing bug (and there was much
711
rejoicing!) - JDH
812

9-
2004-04-16 Added new ti huncker locator a formatter, fixed default font
13+
2004-04-16 Added new ticker locator a formatter, fixed default font
1014
return - JDH
1115

1216
2004-04-16 Added get_name method to FontProperties class. Fixed font lookup

TODO

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@
222222

223223
-- DONE 2004-02-17 make legend attributes accessible
224224

225-
-- decreasing axes - James Boyle <boyle5@llnl.gov>
225+
-- DONE decreasing axes - James Boyle <boyle5@llnl.gov>
226226

227227

228228
-- check out Helge's contour
@@ -242,7 +242,7 @@
242242

243243
-- DONE 2004-02-25 fix setup.py to build ft2
244244

245-
-- TkAgg resize (test on win32)
245+
-- DONE TkAgg resize (test on win32)
246246

247247
-- DONE TkAgg interactive on win32
248248

@@ -258,7 +258,7 @@
258258

259259
-- DONE - (Todd updated docs) - python2.2 no default tkinter
260260

261-
-- check out wx
261+
-- DONE check out wx
262262

263263
-- DONE 2004-03-02 - fix ft2font clipping on agg
264264

@@ -290,7 +290,7 @@
290290

291291
-- add pie charts
292292

293-
-- support fontdicts, with deprecation as necessary
293+
-- DONE support fontdicts, with deprecation as necessary
294294

295295
-- move text layout to front end and support newlines with rotation.
296296

@@ -310,4 +310,7 @@
310310

311311
-- ps backend fails alignment test
312312

313-
-- ps backend is slow! parsing afm files!
313+
-- ps backend is slow! Almost all of this is eaten by parsing afm
314+
files
315+
316+
-- decreasing log axes needs fix

examples/backend_driver.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,23 @@
1717
'barchart_demo.py',
1818
'color_demo.py',
1919
'csd_demo.py',
20+
'date_demo1.py',
21+
'date_demo2.py',
2022
'fill_demo.py',
2123
'figtext.py',
2224
'histogram_demo.py',
2325
'image_demo.py',
2426
'image_demo2.py',
27+
'invert_axes.py',
2528
'legend_demo.py',
2629
'legend_demo2.py',
2730
'line_styles.py',
2831
'log_demo.py',
2932
'log_test.py',
3033
'mathtext_demo.py',
3134
'mri_with_eeg.py',
35+
'major_minor_demo1.py',
36+
'major_minor_demo2.py',
3237
'multiple_figs_demo.py',
3338
'pcolor_demo.py',
3439
'pcolor_demo2.py',

examples/invert_axes.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
"""
2+
3+
You can use decreasing axes by flipping the normal order of the axis
4+
limits
5+
6+
"""
7+
from matplotlib.matlab import *
8+
9+
t = arange(0.01, 5.0, 0.01)
10+
s = exp(-t)
11+
plot(t, s)
12+
13+
set(gca(), 'xlim', [5,0]) # decreasing time
14+
15+
xlabel('decreasing time (s)')
16+
ylabel('voltage (mV)')
17+
title('Should be growing...')
18+
grid(True)
19+
20+
show()

examples/two_scales.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
"""
2+
3+
Demonstrate how to do two plots on the same axes with different left
4+
right scales.
5+
6+
7+
The trick is to use *2 different axes*. Turn the axes rectangular
8+
frame off on the 2nd axes to keep it from obscuring the first.
9+
Manually set the tick locs and labels as desired. You can use
10+
separate matplotlib.ticker formatters and locators as desired since
11+
the two axes are independent
12+
13+
To do the same with different x scales, use the xaxis instance and
14+
call tick_bottom and tick_top in place of tick_left and tick_right
15+
16+
"""
17+
18+
from matplotlib.matlab import *
19+
20+
ax1 = subplot(111)
21+
t = arange(0.0, 10.0, 0.01)
22+
s1 = exp(t)
23+
plot(t, s1, 'b-')
24+
ax1.yaxis.tick_left()
25+
26+
27+
# turn off the 2nd axes rectangle with frameon kwarg
28+
ax2 = subplot(111, frameon=False)
29+
s2 = sin(2*pi*t)
30+
plot(t, s2, 'r.')
31+
ax2.yaxis.tick_right()
32+
33+
34+
xlabel('time (s)')
35+
36+
show()

0 commit comments

Comments
 (0)