Menu

[r4647]: / branches / transforms / examples / auto_layout.py  Maximize  Restore  History

Download this file

35 lines (28 with data), 832 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python
"""
Example: simple line plot.
Show how to make and save a simple line plot with labels, title and grid
"""
from pylab import *
t = arange(0.0, 1.0+0.01, 0.01)
s = cos(2*2*pi*t)
ax1 = subplot(211)
plot(t, s, '-', lw=2)
xlabel('xlabel for top axes')
ylabel('ylabel on the right')
title('About as simple as it gets, folks')
grid(True)
ax1.yaxis.set_label_position('right')
ax1.xaxis.set_ticklabels(['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'])
for label in ax1.get_xticklabels():
label.set_rotation(45)
ax2 = subplot(212)
plot(t, s, '-', lw=2)
grid(True)
xlabel('xlabel for bottom axes (the ticks are on the top for no good reason)')
ylabel('I\'m a lefty')
ax2.xaxis.set_label_position('bottom')
ax2.xaxis.set_ticks_position('top')
#savefig('simple_plot.png')
savefig('simple_plot')
show()
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.