Menu

[r4812]: / trunk / htdocs / examples / image_origin.py  Maximize  Restore  History

Download this file

26 lines (22 with data), 679 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
#!/usr/bin/env python
"""
You can specify whether images should be plotted with the array origin
x[0,0] in the upper left or upper right by using the origin parameter.
You can also control the default be setting image.origin in your
matplotlibrc file; see http://matplotlib.sourceforge.net/matplotlibrc
"""
from pylab import *
x = arange(100.0); x.shape = 10,10
interp = 'bilinear';
#interp = 'nearest';
lim = -2,11,-2,6
subplot(211, axisbg='g')
title('blue should be up')
imshow(x, origin='upper', interpolation=interp)
#axis(lim)
subplot(212, axisbg='y')
title('blue should be down')
imshow(x, origin='lower', interpolation=interp)
#axis(lim)
savefig('image_origin')
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.