You are a guest. Restricted access. Read more

2D plots

Typically, you can build a canvas like this:

from jhplot import HPlot
c1 = HPlot("Canvas",600,400,2,1) # canvas size 600x400, 2 plot regions
c1.visible(49,50)    # show it on the screen at position 40,50
c1.setAutoRange()    # autorange for X
c1.draw(object1)     # draw object1 (H1D,F1D,P1D etc)
c1.draw(object2)     # draw a new object
c1.export("figure.pdf") # export to PDF file

This code create a canvas with the size 600×400 (in pixels), it has 2 pads to show data. The method visible(100,200) make the canvas visible and sets its location on the screen at position 100 (in X from left conner) and 200 (from top) in pixels. If you want a default position, jut call “visible()”. Then you can draw any mathematical object or data. Then you can export the image to vector format. Now you are ready to plot functions, histograms and datasets. See the detail in HPlot

Let's run this code and make an empty canvas with 2 plot regions:


from jhplot import HPlot
c1 = HPlot("Canvas",600,400,2,1) # canvas size 600x400, 2 plot regions
c1.visible()  # make it visible

Let us draw a function on this canvas using the default attributes for the canvas:


from jhplot import HPlot,F1D
c1 = HPlot("Canvas")
c1.visible()
c1.setAutoRange()
f=F1D('sin(x)*x',-10,10) # range -10 - 10
c1.draw(f)

Read SCaVis documentation for detailed description.

One can comment and discuss this section after becoming a full member.

Sergei Chekanov 2010/03/07 16:37

scavis/plotting/2dplots.txt · Last modified: 2013/04/14 16:52 (external edit)
Back to top
CC Attribution-Share Alike 3.0 Unported
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0