3.16 Geometrical primitives

The package jhplot.shapes can be used to display several geometrical primitives, including the text label discussed above:

>>> text=Text("Text", 0.5, 0.2)         # simple text
>>> line=Line(0.1,0.9, 0.2, 0.9)        # line
>>> arrow=Arrow(0.85, 0.5, 0.85, 0.7)   # arrow
>>> picture=Picture(0.8, 0.95, fileName)# PNG or JPG figure
>>> circle=Circle(0.5, 0.5, 0.1)        # circle with R=0.1
>>> rectangle=Rectan(0.0,10.0,0.9,1.2)  # rectangle (w=0.9, h=1.2)
>>> ellipse=Ellipse(0.0,10.0,0.9,1.2)   # radious 0.9 in X and 1.2 in Y
To show such primitives, use add() method and execute update(). All primitives, such as Text, Line, Picture, Arrow, Circle and Rectan can be shown in the NDC system using the method setPosCoord("NDC").

To fill the primitives, use the method setFill(1). The color and the transparency is set by the setColor(Color) and setFont(Font) method.

Several examples from the jhplot.shapes package are given in the example directory.