**Table of Content**

**Search clouds**

**Licenses**

**Author's resources**

You are a guest. Restricted access. Read more.

Command disabled: revisions

Using SCaVis canvases, one can draw lines, arrows, ovals, interactive labels. One can use the same canvas as for plotting data and functions.

For example, use the canvas HPlot. One can add objects using the method “add” and the call “update()” method to draw all objects at once:

Download for this example is disabled for non-members

1: from jhplot import * 2: from jhplot.shapes import * 3: 4: c1=HPlot("Canvas") 5: c1.setGTitle("HShape package") 6: c1.setLegend(0) 7: c1.setRange(-4.0,4.0,0.0,20.0) 8: c1.visible() 9: arr=Arrow(0.85,0.5,0.85,0.7) 10: arr.setColor(Color.blue) 11: arr.setPosCoord("NDC") 12: c1.add(arr) 13: lab=HLabel("Interactive label",-2,10); 14: c1.add(lab) 15: c1.update()

Let us show how to draw interactive diagrams using the class HPlotJa. This class also can be used to show data, histograms and functions, but it is better suited for interactive diagram drawing.

We will show below how to draw Feynman diagrams:

Download for this example is disabled for non-members

1: from java.awt import * 2: from jhplot import * 3: from jhplot.jadraw import Diagram 4: 5: c1=HPlotJa("Canvas",1000,750,1,1,0) 6: c1.setGTitle("Feynman Diagram objects", Color.blue) 7: c1.visible() 8: c1.showEditor(1) # show diagram editor 9: gl=Diagram.Box(0.05,0.1) # box 10: gl.setRelWH(0.05,0.05,"NDC") 11: c1.add(gl) 12: gl=Diagram.Blob(0.05,0.2) # blob 13: gl.setRelWH(0.01,0.01,"NDC") 14: c1.add(gl) 15: gl=Diagram.Vertex(0, 0.05,0.3) # a vertex 16: gl.setRelWH(0.01,0.01,"NDC") 17: c1.add(gl) 18: gl=Diagram.GLine(0.6,0.7) # gluon line 19: gl.setRelWH(0.1,0.2,"NDC") 20: c1.add(gl) 21: c1.update()

click here if you want to know more

click here if you want to know more

A complete description of how to use Java, Jython and SCaVis for scientific analysis is described in the book Scientific data analysis using Jython and Java published by Springer Verlag, London, 2010 (by S.V.Chekanov)

— *Sergei Chekanov 2010/03/07 16:37*