3. An Overview of Graphics

One  can use Mathematica to make 2 D and 3 D graphics. It is perhaps the most straightforward and, at the same time, the most complicated section. It is straightforward since all the commands and properties one can find  in the Help Browser. However, the complicated part is to find the property  one needs among hundreds of similar ones.  Below there are only examples of some of the most commongly used graphic features. Moreover, the older versions of Mathematica might have different names and commands. The following pictures are drawn in Mathematica 7. The pictures are mostly self-explanatory and for the useage of unknown functions the reader is referred to the documentation center.

Plot[Sin[(x^2)],{x,0,4},PlotRange->{0,1.2}]

ParametricPlot3D[{Sin[z]Sin[t],Sin[z]Cos[t],z},{z,-π,π},{t,0,2π},PlotRange->{{0,1},{0,1},{0,1}}]

Plot[(x^5)-4.5(x^4)+2.1(x^2)-7,{x,-10,14},PlotRange->All]

Graphics[Circle[{0,0},1],PlotLabel->"circle"]

Graphics[Circle[{0,0},1],AspectRatio->1/2,PlotLabel->"ellipse"]

Graphics[Circle[{0,0},1],Axes->Automatic]

Plot[Sin[x],{x,0,2 π},Ticks->{{0,(π/2),π,((3 π)/2),2 π},Automatic}]

Plot[Sin[x],{x,0,2π},AxesStyle->{RGBColor[1,0,0],Thickness[0.01]}]

Plot[Sin[x],{x,0,2π},Frame->True]

Plot[Log[x]+Sin[x+(Sqrt[2])Sin[x]],{x,0,10},GridLines->Automatic]

data=Table[Sin[x]+Random[Real,{-0.1,0.1}],{x,0,2π,0.1}]

ListPlot[data]

ListLinePlot[data]

Plot[{BesselJ[2,z],BesselJ[3,z],BesselJ[4,z]},{z,-10,16},PlotStyle->{Hue[0.5],Hue[0.6],Hue[0.7]}]

Plot3D[Sin[x y],{x,0,2π},{y,0,2π},PlotPoints->40]

Plot3D[Sin[x y],{x,0,2π},{y,0,2π},PlotPoints->10]

Plot3D[4(E^(-(((x-1))^2)-(((y-2))^2))),{x, -2,2},{y,-3,3},PlotRange->All,AxesLabel->{"x","y","z"}]

Show[%,ViewPoint->{1.2,1.2,1.2}]

Plot3D[4(E^(-(((x-1))^2)-(((y-2))^2))),{x, -2,2},{y,-3,3},PlotRange->All,AxesLabel->{"x","y","z"}]

Show[%,ViewVertical->{1,0,0}]

Plot[Sin[x],{x,0,2π},Background->GrayLevel[0.5]]

Quit[]

PolyhedronData["Dodecahedron"]

ListPlot3D[Table[Mod[y,x],{x,10,30},{y,10,30}]]

The function Show is used to combine several graphics togather.

plot1=Plot[Sin[x],{x,-2Pi,2 π},PlotStyle->Red];

plot2=Plot[Sin[2 x],{x,-2Pi,2 π},PlotStyle->Green];

plot3=Graphics[{Yellow,Circle[{0,0},1]}];

Show[plot1,plot2,plot3,AspectRatio->Automatic]

Graphics[primitives, options]represents a two-dimensional graphical image (circle, disc, point, line, polygon, ... ).

vertices={{0,-1},{1,0},{0,1},{-1,0},{0,-1}};

p=Graphics[{RGBColor[1,0,0],Polygon[vertices]}];

l=Graphics[{Thickness[.02],RGBColor[0,0,1],Line[vertices]}];

Show[p,l]

p1=Plot[Sin[x],{x,0,2 π}]

p2=Plot[Sin[2 x],{x,0,2 π}];

GraphicsGrid[{{p1,p2}}]

GraphicsGrid[{{p1},{p2}}]

RandomReal[{0,1},{24,2}]

Graphics[Line[RandomReal[{0,1},{24,2}]]]

Graphics[{Hue[.77],Rectangle[{0,0},{5,1}],Hue[.17],Rectangle[{3,0},{4,2}]}]

Graphics3D[{Cuboid[{0,0,0}],Cuboid[{0,0,1}],Cuboid[{0,1,1}],Cuboid[{1,1,1}]}]

Graphics[{Circle[{0,0},1],Circle[{0,0},{2,1}],Circle[{(3/2),-(1/4)},((Sqrt[5])/4),{(1/2),2}]},AspectRatio->Automatic,Axes->Automatic]

InscribedCircleData[pA:{_,_},pB:{_,_},pC:{_,_}]:=Module[{AB,BC,AC,a,b,c,s,pP,pQ,AP,BQ,p,q,ps,qs,pqs,incenter,inradius},AB=pB-pA;BC=pC-pB;AC=pC-pA;a=(Sqrt[BC.BC]);b=(Sqrt[AC.AC]);c=(Sqrt[AB.AB]);AP=pB+p BC-pA;BQ=pA+q AC-pB;ps=Solve[((AP.AB)/c)==((AP.AC)/b),p][[1,1]];qs=Solve[((BQ.BC)/a)==((BQ.(-AB))/c),q][[1,1]];pP=pB+p BC/.ps;pQ=pA+q AC/.qs;pqs=Solve[pA+p (pP-pA)==pB+q (pQ-pB),{p,q}][[1]];incenter=pA+p (pP-pA)/.pqs;s=(1/2) (a+b+c);inradius=(Sqrt[(((s-a) (s-b) (s-c))/s)]); {incenter,inradius}]

InscribedCircle[pA:{_,_},pB:{_,_},pC:{_,_}]:=Graphics[{Line[{pA,pB,pC,pA}],Circle[Sequence@@InscribedCircleData[pA,pB,pC]]},AspectRatio->Automatic,PlotRange->All,Frame->True]

InscribedCircle[{1.8,6.8},{3.1,1.1},{6.4,2.4}]

Graphics[{{RGBColor[0,0,1],Disk[{0,0},{2,1}]},{RGBColor[0,1,1],Disk[{0,0},1]},{RGBColor[1,1,0],Disk[{0,0},2,{0,1}]}},AspectRatio->Automatic,Axes->Automatic]

Graphics[{Text["Left",{-1,0},{-1,0}],Text["Right",{1,0},{1,0}],Text["Above",{0,1},{0,-1}],Text["Below",{0,-1},{0,1}],{PointSize[.075],RGBColor[1,0,0],Point[{0,0}]}},PlotRange->All]

ListPlot[Table[{x,EulerPhi[x]},{x,15}],PlotStyle->PointSize[0.02]]

Graphics[{Dashing[{0.15,0.05}],Circle[{0,0},1]},AspectRatio->Automatic]

Play[Sin[(2^t)],{t,11,14}]

Animate[Plot[Sin[n x], {x, 0, 2 Pi}, Axes -> False], {n, 1, 3, 1}]

g = ParametricPlot3D[
 {x, Cos[t] Sin[x] , Sin[t] Sin[x]},
      {x, -Pi, Pi}, {t, 0, 2Pi},
      Axes -> False, Boxed -> False]

Quit[]

Graphics[{Arrow[{{0, 0},{1, 1}}],
    Hue[0], Arrow[{{.75, .25},{.25, .75}}]}]

Plot[Sin[x], {x, 0, 2Pi},
    Epilog -> {Arrow[{{4, .25}, {Pi/2, 1}}],
     Text["Here", {4, .15}, {0, -1}]}
]

ContourPlot[x^2 + 2 y^2 == 3, {x, -2, 2},{y,-2,2}]

ContourPlot[{(x^2 + y^2)^2 == (x^2 - y^2),
 (x^2 + y^2)^2 == 2 x y}, {x,-2,2},{y,-2,2}
]

RegionPlot[ 1≤(((x+2y))^2)+4(y^2)≤4, {x, -3, 3}, {y, -3, 3} ]

RegionPlot3D[ (x^2)+(y^2)+(z^2)≤1∧ 3(x^2)+3(y^2)≤ (z^2), {x,-1,1}, {y,-1,1}, {z,-1,1}]

VectorPlot[{Sin[x],Cos[y]},{x,0,Pi},{y,0,Pi}]

RevolutionPlot3D[
          Sin[x], {x, 0, 2 Pi}]

RevolutionPlot3D[{1.1 Sin[u], u^2},
  {u, 0, 3 Pi/2}, BoxRatios -> {1, 1, 2}]

RevolutionPlot3D[x^2, {x, 0, 1},
    RevolutionAxis -> {1, 1, 1}]

FinancialData["GE","Price"]

DateListLogPlot[FinancialData["^DJI",All],Joined->True,Filling->Bottom]

Plot[Table[BesselJ[n,x],{n,4}],{x,0,15},Filling->Axis,Evaluated->True]

ContourPlot[Sin[3 x] Cos[x+y],{x,0,3},{y,0,3},ContourLabels->Automatic,ColorFunction->"Pastel"]

ParametricPlot3D[{Cos[v]+0.3 Sin[3 u]+0.04 Sin[20 v],u,Sin[v]+0.3 Cos[3 u]+0.04 Sin[20 v]},{u,-π,π},{v,-π,π},PlotPoints->100,PlotStyle->{Orange,Specularity[White,10]},Axes->None,Mesh->None]

One can innsert a plot into a disk:

Graphics[{LightGray,Disk[],Inset[Plot[Tan[x],{x,-3,3}]]}]

One can insert an expression in a graphic:

Graphics[{Circle[],Inset[X^2+Y^2==1,{0,0}]}]

solution2=NDSolve[{x''[t]+x[t]^3==Sin[t],x[0]==x'[0]==0},x,{t,0,50}]

ParametricPlot[{x[t],x'[t]}/.solution2,{t,0,50}]

Block[{f=Cos[x+I y]},ParametricPlot[Evaluate[{Re[f],Im[f]}],{x,-Pi,Pi},{y,-2,2}]]