2003-12-16 22:25:56 -05:00
|
|
|
|
|
|
|
import wx
|
|
|
|
import wx.lib.plot
|
|
|
|
|
|
|
|
################################################################\
|
|
|
|
# Where's the code??? |
|
|
|
|
# |
|
|
|
|
# wx.lib.plot.py came with its own excellent demo built in, |
|
|
|
|
# for testing purposes, but it serves quite well to demonstrate |
|
|
|
|
# the code and classes within, so we are simply borrowing that |
|
2004-01-20 20:48:24 -05:00
|
|
|
# code for the demo. Please load up wx.lib.plot.py for a review |
|
2003-12-16 22:25:56 -05:00
|
|
|
# of the code itself. The demo/test is at the bottom of |
|
|
|
|
# the file, as expected. |
|
|
|
|
################################################################/
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
|
|
|
def runTest(frame, nb, log):
|
|
|
|
# Loading the demo class directly from the library's
|
|
|
|
# test code.
|
|
|
|
win = wx.lib.plot.TestFrame(nb, -1, "PlotCanvas Demo")
|
|
|
|
frame.otherWin = win
|
|
|
|
return None
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
|
|
|
overview = """\
|
|
|
|
<html><body>
|
|
|
|
<center><h2>PyPlot</h2></center>
|
|
|
|
|
|
|
|
This demo illustrates the features of the new PyPlot modules, found
|
|
|
|
in wx.lib.plot.py. All methods and functions are documented clearly
|
|
|
|
therein; only the overview is included here.
|
|
|
|
|
|
|
|
<p>
|
|
|
|
PyPlot is an improvement over wxPlotCanvas, which is now deprecated.
|
|
|
|
If you are using wxPlotCanvas now, please make plans to migrate in
|
|
|
|
anticipation of the time that wxPlotCanvas disappears completely.
|
|
|
|
|
|
|
|
<p>
|
|
|
|
The demo illustrates four different plot styles (with appropriate
|
|
|
|
variations on fonts, etc, to show how flexible it is) as well as
|
|
|
|
provides you with a means to tinker with all the features that
|
|
|
|
come with the class itself.
|
|
|
|
|
|
|
|
<p><ul>
|
|
|
|
<li>File Menu
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
<li>Page Setup
|
|
|
|
|
2004-01-20 20:48:24 -05:00
|
|
|
<p>This allows you to set up how the plot will be printed. This
|
2003-12-16 22:25:56 -05:00
|
|
|
is built into the library itself.
|
|
|
|
|
|
|
|
<li>Print Preview
|
|
|
|
|
2004-01-20 20:48:24 -05:00
|
|
|
<p>As you might expect, this allows you to preview how the plot
|
2003-12-16 22:25:56 -05:00
|
|
|
will look when printed, in light of the page setup you may
|
|
|
|
have selected above.
|
|
|
|
|
|
|
|
<li>Print
|
|
|
|
|
2004-04-29 13:45:59 -04:00
|
|
|
<p>Surprise! It prints the current plot to your printer! :-)
|
2003-12-16 22:25:56 -05:00
|
|
|
|
|
|
|
<li>Save Plot
|
|
|
|
|
2004-01-20 20:48:24 -05:00
|
|
|
<p>That's right, the library even provides you with the means
|
2003-12-16 22:25:56 -05:00
|
|
|
to export the plotted data out to a graphics file. Several
|
|
|
|
formats are allowed for, basically any image class that
|
|
|
|
supports saving.
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<li>Plot Menu
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
<li>Plot 1 ... Plot 5
|
|
|
|
|
2004-01-20 20:48:24 -05:00
|
|
|
<p>Different data with different plot formats, including one empty
|
2003-12-16 22:25:56 -05:00
|
|
|
plot.
|
|
|
|
|
|
|
|
<li>Enable Zoom
|
|
|
|
|
2004-01-20 20:48:24 -05:00
|
|
|
<p>If Zoom is enabled, you can rubber-band select an area of the
|
2003-12-16 22:25:56 -05:00
|
|
|
plot to examine it in detail using the left mouse button. Right
|
|
|
|
mouse button zooms back out. This is automatically supported
|
|
|
|
by the library, all you have to do is turn it on.
|
|
|
|
|
|
|
|
<li>Enable Grid
|
|
|
|
|
2004-01-20 20:48:24 -05:00
|
|
|
<p>Plots can have different styles of grids, and and these grids can
|
2003-12-16 22:25:56 -05:00
|
|
|
be turned on or off as needed.
|
|
|
|
|
|
|
|
<li>Enable Legend
|
|
|
|
|
2004-01-20 20:48:24 -05:00
|
|
|
<p>Plot can have legends or not, the contents which are definable
|
2003-12-16 22:25:56 -05:00
|
|
|
by you.
|
|
|
|
</ul>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<HR><pre>
|
|
|
|
%s</pre>
|
|
|
|
</body></html>
|
|
|
|
""" % wx.lib.plot.__doc__
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
import sys,os
|
|
|
|
import run
|
2004-03-04 19:06:33 -05:00
|
|
|
run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
|
2003-12-16 22:25:56 -05:00
|
|
|
|