logo
Overview  Gallery  Introduction  Objects  Packages  Packages 3D  Basic Options  3D Options  Advanced 

3. Working with Graphics Packages

Standard

The built-in commands in 2D allow to render function graphs and parametrized planar curves.

Function Graph

Graph of a sin curve. In[1]:= p1 = Plot[3Sin[t], {t, -Pi, Pi}]

In[2]:= JavaView[p1]


Compare with Mathematica

2D Curves

Parametrized planar curve. In[1]:= p2 = ParametricPlot[{Cos[5t], Sin[3t]}, {t, 0, 2Pi}, AspectRatio -> Automatic];

In[2]:= JavaView[p2]


Compare with Mathematica

Graphics`ComplexMap`

This plots the image of a complex function for a given domain. In[1]:= << Graphics`ComplexMap`
In[2]:= pm = PolarMap[Exp, {0, 4, 1/4}, {Pi/2, Pi, Pi/16}];

In[3]:= JavaView[pm]


Compare with Mathematica

 

Graphics`FilledPlot`

This specifies which curves to fill between and the colors of the filled regions. In[1]:= << Graphics`FilledPlot`
In[2]:= fp = FilledPlot[{Exp[-x], Cos[x], Sin[x]}, {x, 0, 2 Pi}, Fills -> {{{1, Axis}, RGBColor[1, 0, 0]}, {{3, 2}, RGBColor[0, 0, 1]}}, Curves -> Front]

In[3]:= JavaView[fp]


Compare with Mathematica

Graphics`Graphics`

This plots an ellipse and a limacon on the same graph. In[1]:= <<Graphics`Graphics`
In[2]:= gp = PolarPlot[{4/(2 + Cos[t]), 4Cos[t] - 2}, {t, 0, 2Pi}];

In[3]:= JavaView[gp]


Compare with Mathematica

Graphics`ImplicitPlot`

This plots an ellipse using the Solve method. In[1]:= <<Graphics`ImplicitPlot`
In[2]:= ip = ImplicitPlot[x^2 + 2 y^2 == 3, {x, -2, 2}];

In[3]:= JavaView[ip]


Compare with Mathematica

Graphics`Legend`

This shows sine and cosine curves with a legend. JavaView fails : Graphics inside a rectangle command are not parsed.

Not supported yet.

In[1]:= <<Graphics`Legend`
In[2]:= l = Plot[{Sin[x], Cos[x]}, {x, -2 Pi, 2 Pi}, PlotStyle -> {GrayLevel[0], Dashing[{.03}]}, PlotLegend -> {"Sine", "Cosine"}];

In[3]:= JavaView[l]


Compare with Mathematica

Graphics`MultipleListPlot`

This shows two sets of points, displayed as little stars. JavaView fails : MultipleListPlot makes intense use of Offset, which is not supported. In[1]:= <<Graphics`MultipleListPlot`
In[2]:= (list1 = Table[{x, Sin[2 Pi x]}, {x, 0, 1, 0.1}]; list2 = Table[{x, Cos[2 Pi x]}, {x, 0, 1, 0.1}]);
In[3]:= mlp = MultipleListPlot[list1, list2, PlotJoined -> True]

In[4]:= JavaView[mlpp]

 
Compare with Mathematica

Graphics`PlotField`

Draws two-dimensional vector fields on a planar domain.

The two components of this vector field are given by sin(x) and cos(y). In[1]:= <<Graphics`PlotField`
In[2]:= gv = PlotVectorField[{Sin[x], Cos[y]}, {x, 0, Pi}, {y, 0, Pi}];

In[3]:= JavaView[gv]


Compare with Mathematica

Miscellaneous`WorldPlot`

This will show a map of Africa. In[1]:= <<Miscellaneous`WorldPlot`
In[2]:= a = WorldPlot[{Africa, RandomColors}, WorldProjection -> Sinusoidal]

In[3]:= JavaView[a]


Compare with Mathematica

DiscreteMath`Combinatorica`

Showing Graphs

This packages provides the Graph object which consists of a set of vertices and its adjacency matrix. Several commands produce and modify such graphs.

The command ShowGraph[] converts a Graph object in a Graphics object containing points and lines as a set of separate graphics primitives.

The adjacency matrix is stored in full size in the Graph object.

JavaView receives a graph as two separate geometries, a point set and a polygon set. The point set is obsolete if the the vertices of the polygon set are made visible.

JavaView[sg]
  In[1]:= <<DiscreteMath`Combinatorica`
In[2]:= sg = ShowGraph[GridGraph[3, 3]]

In[3]:=


Compare with Mathematica

DiscreteMath`ComputationalGeometry`

Plot of the Voronoi diagram of given points. In[1]:= <<DiscreteMath`ComputationalGeometry`
In[2]:= data2D = {{4.4, 14}, {6.7, 15.25}, {6.9, 12.8}, {2.1, 11.1}, {9.5, 14.9}, {13.2, 11.9}, {10.3, 12.3}, {6.8, 9.5}, {3.3, 7.7}, {0.6, 5.1}, {5.3, 2.4}, {8.45, 4.7}, {11.5, 9.6}, {13.8, 7.3}, {12.9, 3.1}, {11, 1.1}};
In[3]:= v = DiagramPlot[data2D];

In[4]:= JavaView[v]


Compare with Mathematica

DiscreteMath`Tree`

This shows a graphical representation of a tree with 10 nodes. In[1]:= <<DiscreteMath`Tree`
In[2]:= tp = TreePlot[MakeTree[Range[10]]]

In[3]:= JavaView[tp]


Compare with Mathematica
© 1997-2017 Last modified: 22.06.2017 --- www.javaview.de --- The JavaView Project