Code Search for Developers
 
 
  

units_test.py from matplotlib at Krugle


Show units_test.py syntax highlighted

import matplotlib.basic_units as bu
from matplotlib.pylab import figure, show, nx

cm = bu.BasicUnit('cm', 'centimeters')
inch = bu.BasicUnit('inch', 'inches')

inch.add_conversion_factor(cm, 2.54)
cm.add_conversion_factor(inch, 1/2.54)

lengths_cm = cm*nx.arange(0, 10, 0.5)
fig = figure()
ax = fig.add_subplot(211)
ax.plot(lengths_cm, 2.0*lengths_cm, xunits=cm, yunits=cm)
ax.set_xlabel('in centimeters')
ax = fig.add_subplot(212)
ax.plot(lengths_cm, 2.0*lengths_cm, xunits=inch, yunits=cm)
ax.set_xlabel('in inches')
#fig.savefig('simple_conversion.png')
show()




See more files for this project here

matplotlib

Matplotlib is a pure python plotting library with the goal of making\r\npublication quality plots using a syntax familiar to matlab users. \r\nThe library uses Numeric for handling large\r\ndata sets and supports a variety of output backends

Project homepage: http://sourceforge.net/projects/matplotlib
Programming language(s): C,C++,Python
License: other

  modified/
    _transforms.cpp
    _transforms.h
    axes.py
    lines.py
    transforms.py
    units.py
  Makefile
  README
  units_test.py