@@ -11,7 +11,7 @@ resources for the API
1111 - the matplotlib artist tutorial :
1212 http://matplotlib.sourceforge.net/pycon/artist_api_tut.pdf
1313
14- - the "leftwich tutorial" -
14+ - the "leftwich tutorial" :
1515 http://matplotlib.sourceforge.net/leftwich_tut.txt
1616
1717 The example agg_oo.py is the simplest example of using the Agg
@@ -22,3 +22,27 @@ resources for the API
2222 the API for everything else. This is a good solution for production
2323 quality scripts. For full fledged GUI applications, see the
2424 user_interfaces examples.
25+
26+ Example style guide
27+ ===================
28+
29+ If you are creating new examples, you cannot import pylab or import *
30+ from any module in your examples. The only three functions allowed
31+ from pyplot are "figure", "show" and "close", which you can use as
32+ convenience functions for managing figures. All other matplotlib
33+ functionality must illustrate the API.
34+
35+ A simple example of the recommended style is::
36+
37+ import numpy as np
38+ import matplotlib.pyplot as plt
39+
40+ fig = plt.figure()
41+ ax = fig.add_subplot(111) # or add_axes
42+ ax.plot(np.random.rand(10))
43+ ax.set_xlabel('some x data')
44+ ax.set_ylabel('some y data')
45+ ax.set_title('some title')
46+ ax.grid(True)
47+ fig.savefig('myfig')
48+ plt.show()
0 commit comments