Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Topic: Dummy Plotting
Replies: 0

 keystonethewizard@gmail.com Posts: 3 Registered: 6/28/13
Dummy Plotting
Posted: Jun 28, 2013 3:47 AM

Sorry if this shows twice, last time showed an error.

I'm trying to make a dummy-proof plotting template. I've been able to figure out most things but cannot seem to make the function arrowheads the same colour as the functions. The last line adds the function arrowheads.

ClearAll["Global`*"];
Interpretation[{f = { 1/(x - 1), Sin[x], -x, x},
points = {{3, 2}, {-5, -8}}, min = -10, max = 10, size = 0.5,
rmin = -10, rmax = 10, gridx = 1, gridy = 1, hlabel = "x",
vlabel = "y"},
Panel[Grid[{{Style["Plot Characteristics", Bold], SpanFromLeft},
{"Functions:", InputField[Dynamic[f]]},
{"Points:", InputField[Dynamic[points]]},
{"Domain Min:", InputField[Dynamic[min]]},
{"Domain Max:", InputField[Dynamic[max]]},
{"Range Min:", InputField[Dynamic[rmin]]},
{"Range Max:", InputField[Dynamic[rmax]]},
{"Grid Size (cm):", InputField[Dynamic[size]]},
{"Gridline Space x:", InputField[Dynamic[gridx]]},
{"Grdiline Space y:", InputField[Dynamic[gridy]]},
{"Horizontal Label:", InputField[Dynamic[hlabel]]},
{"Vertical Label:", InputField[Dynamic[vlabel]]}

}]],
Plot[f, {x, min - gridx/2, max + gridx/2},
PlotRange -> {rmin - gridy, rmax + gridy} ,
GridLines -> {Range[min, max, gridx], Range[rmin, rmax, gridy]},
GridLinesStyle -> {{Dashed, CMYKColor[0, 0, 0, 1, 0.25],
AbsoluteThickness[0.5]}, {Dashed, CMYKColor[0, 0, 0, 1, 0.25],
AbsoluteThickness[0.5]}},
Ticks -> {Range[min, max, gridx], Range[rmin, rmax, gridy]},
TicksStyle ->
Directive[10, Opacity[0], FontOpacity -> 0.9999,
CMYKColor[0, 0, 0, 1], FontFamily -> "Helvetica"],
ImageSize -> {(max - min)*37.795375591*size +
6.1*StringLength[hlabel], (rmax - rmin)*37.795375591*size + 8},
AspectRatio -> Full,
AxesLabel -> {Style[hlabel, Italic], Style[vlabel, Italic]},
LabelStyle -> {{FontFamily -> "Helvetica", FontSize -> 14}},
AxesStyle -> {CMYKColor[1, 1, 1, 1], AbsoluteThickness[0.5]},
PlotStyle -> {{AbsoluteThickness[1],
CMYKColor[0, 0, 0, 1]}, {AbsoluteThickness[1],
CMYKColor[0, 0.83, 1, 0]}, {AbsoluteThickness[1],
CMYKColor[1, 0, 0, 0]}, {AbsoluteThickness[1],
CMYKColor[0.36, 1, 0, 0]}, {AbsoluteThickness[1],
CMYKColor[0.63, 0, 1, 0]}, {AbsoluteThickness[1],
CMYKColor[0, 0, 0, 1]}},
Epilog -> {Arrowheads[{0.04, 0.01, {0, 0.03}}],
Arrow[{{max + gridx/2, 0}, {max + gridx/2 + gridx/10, 0}}],
Arrow[{{min - gridx/2, 0}, {min - gridx/2 - gridx/10, 0}}],
Arrow[{{0, rmax + gridy}, {0, rmax + gridy + gridy/10}}],
Arrow[{{0, rmin - gridy}, {0, rmin - gridy - gridy/10}}],
AbsolutePointSize[5], Point[points]}
]
/. Line[x__] :> Sequence[Arrowheads[{-.04, .04}], Arrow[x]]
]