Graphing II

\(Needs["Graphics`Master`"]; 
Needs["Calculus`Master`"]; \)

2-dimensional Graphics Primitives

This defines the graphics for a point, but does not show them.

Graphics[Point[{0, 2}]]

If you want to see Graphics Primitives, wrap "Show" around them.

Show[Graphics[Point[{0, 2}]]];

\(\(Show[
	
      Graphics[Table[Point[{i, i^2}], {i, \(-5\), 5, .05}]
	]
]; \)\)

\(\(Show[
	
      Graphics[
		Circle[{0, 0}, 4], AspectRatio -> Automatic
	]
]; 
    \)\)

\(\(Show[
	
      Graphics[
		Disk[{0, 0}, 4], AspectRatio -> Automatic
	]
]; \)\)

\(\(Show[
	
      Graphics[
		Disk[{0, 0}, 4, {π/4, 3  π/4}], 
        AspectRatio -> Automatic
	]
]; \)\)

\(\(Show[
	Graphics[
		Line[{{\(-4\), 3}, {0, 0}}]
	]
]; \)\)

\(\(Show[
	
      Graphics[
		Line[Table[{i, i^2}, {i, \(-5\), 5, 3}]]
	]
]; \)\)

"Polygon" works the same as "Line", but the first and the last point are connected and the area inside the polygon is shaded.

\(\(Show[
	
      Graphics[
		Polygon[Table[{i, i^2}, {i, \(-5\), 5, 3}]]
	]
]; 
    \)\)

pol[k_] := 
      Show[Graphics[
          Polygon[Table[{Cos[2  π m/k], Sin[2  π m/k]}, {m, 1, 
                k}]]], AspectRatio -> Automatic];

pol[8];

You may combine Graphics Primitives:

Show[
      Graphics[{
          Polygon[Table[{Cos[2  π m/6], Sin[2  π m/6]}, {m, 1, 
                6}]], Circle[{0, 0}, 1]}], AspectRatio -> Automatic];

For Graphics Primitives, "Style Directives" are included in front of the Primitives:

\(\(Show[
      Graphics[

        		{
			{Blue, 
            Polygon[Table[{Cos[2  π\ m/6], Sin[2  π\ m/6]}, {m, 1, 
                  6}]]}, {Red, AbsoluteThickness[7], Circle[{0, 0}, 1]}

          		}], AspectRatio -> Automatic]; \)\)

\(\(pic = 
      Show[Graphics[

          		{
			{Red, AbsoluteThickness[7], Circle[{0, 0}, 1]}, {Blue, 
              Polygon[Table[{Cos[2  π\ m/6], Sin[2  π\ m/6]}, {m, 1, 
                    6}]]}
		}], AspectRatio -> Automatic]; \)\)

Rasters and Color Models

All color models require inputs between 0 and 1.

Show[Graphics[{RGBColor[0, 1, 0], PointSize[.25], Point[{0, 0}]}]];

Show[
      Graphics[{CMYKColor[1, 0, 0, 0.5], PointSize[.25], Point[{0, 0}]}]];

Show[Graphics[{GrayLevel[0.5], PointSize[.25], Point[{0, 0}]}]];

Show[Graphics[{Hue[0.2], PointSize[.25], Point[{0, 0}]}]];

Show[
      Graphics[Table[{Hue[.01  t], AbsolutePointSize[5], Point[{t, t^2}]}, {
            t, 0, 100}]]];

matr = Table[Random[], {3}, {3}]

"Raster" takes as its input a matrix of real numbers.

Show[Graphics[Raster[matr]], Frame -> True];

Show[Graphics[Raster[matr, ColorFunction -> Hue]]];

Show[
      Graphics[Raster[matr, 
          ColorFunction -> Function[s, RGBColor[1 - s, 0, 0]]]]];

"RasterArray" takes as its input a matrix of color directives.

Show[
      Graphics[RasterArray[{{Blue, Red, Green}, {LightBlue, DarkGreen, 
              Brown}, {Orange, White, Black}}]]];

\(\(Show[
      Graphics[
		
        RasterArray[
          Table[RGBColor[\((i + j)\)/60, 0, 1 - \((i + j)\)/60], {i, 1, 30}, {
              j, 1, 30}]]]]; \)\)

lst = 
      Table[PrimeQ[10  i + j] /. {False -> Red, True -> Blue}, {i, 0, 9}, {j, 
          1, 10}];

Show[Graphics[RasterArray[lst]]];

The Text Primitive

Show[Graphics[Text["Hello", {0, 0}]], Axes -> True];

pict = 
      Show[Graphics[Text["Hello", {0, 0}, Background -> Automatic]], 
        Axes -> True];

Show[pic, pict];

Show[Graphics[Text["Hello", {0, 0}, {-1, -1}]], 
      Axes -> True];

Show[
      Graphics[Text["Hello", {0, 0}, {-1, -1}, {1, -1}]], 
      Axes -> True];

Table[
      Show[Graphics[
          Text[StringForm["This is the ``th picture.", k], {0, 0}]]], {k, 
        5, 7}];

$TextStyle

$TextStyle
       = {FontFamily -> "Times", FontWeight -> "Bold", 
        FontSize -> 24}

Etc

Helmut Knaust, email: helmut@math.utep.edu. Created 3-9-1999.