On Thu, Feb 14, 2008 at 5:26 AM, sa6113 <[EMAIL PROTECTED]> wrote:

>  I want to draw an xy-plot using the " Backend Agg " of matplotlib.
>  But I don't know how I must start ...
>
>  Would you plz help me or send me an example code ??

import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt

x, y = np.random.rand(2,100)

fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(x, y, marker='o', linestyle='', markerfacecolor='green')
ax.set_title('Some random dots')
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.grid(True)
fig.savefig('myplot.png', dpi=100)
plt.show()

If you want a figure window to popup, you can
"matplotlib.use('TkAgg')" instead of Agg.

See also

  - Tutorial: http://matplotlib.sf.net/tutorial.html

  - User's Guide: http://matplotlib.sourceforge.net/users_guide_0.91.2svn.pdf

  - Examples: http://matplotlib.sourceforge.net/examples

  - Examples with screenshots:
http://matplotlib.sourceforge.net/screenshots.html

Hope this helps,
JDH

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to