If you are debugging a script, one needs often run it (using the key F8) and then manually close the HPlot canvas. If you do not close the HPlot canvas, a new instance of the canvas will be created. Sometimes it is useful, if one needs to compared the results with the previous run.
However, one can avoid creation of new canvas instances by using SHPlot class:
>>> from jhplot import SHPlot >>> >>> c1 = SHPlot.getCanvas() >>> c1.visible() >>> c1.setAutoRange()
Now "c1" represents a SHPlot object, which a singleton extension of HPlot canvas. You can pass exactly the same arguments as for HPlot class, i.e.
>>> c1 = SHPlot.getCanvas("test",600,400,2,2)
will create 4 plots inside the canvas of the size 600x400.
When you create the canvas using SHPlot.getCanvas, the canvas can be instantiated once, and only once. If canvas already exits from the previous run, it will be cleared and then new plot will be drawn. In this case, you do not close the canvas manually.
Look at the example shplot.py, and try to run it several times without closing the canvas manually.