Passing function to custom plotting routine
- To: mathgroup at smc.vnet.net
- Subject: [mg123393] Passing function to custom plotting routine
- From: Chris Young <cy56 at comcast.net>
- Date: Mon, 5 Dec 2011 05:16:12 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
I'm not getting the same plot as I did before when I try to pass the
function to the contourPlot routine below. I'm hoping that the "p"
variable will be controlled by the Locator, but the plot isn't the
same: it starts off with solid blue, there seem to be two sets of
contours, and I get "overflow" errors.
f[p_, z_] := Tanh[p ^z];
contourPlot[f_] :=
Manipulate[
ContourPlot[
f,
{x, -5, 5}, {y, -4, 4},
Contours -> contours,
PlotPoints -> plotPts,
MaxRecursion -> maxRecurs,
Axes -> True,
ImageSize -> {300, 4/5 300},
AspectRatio -> 4/5
],
{{p, {1, 1}}, Locator},
{{contours, 5}, 0, 80, 5},
{{plotPts, 20}, 10, 80, 5},
{{maxRecurs, 1}, 1, 10, 1}
]
contourPlot[Arg @ f[p, x + I y]]
Below is the direct routine (with a few additional options).
Manipulate[
ContourPlot[
Arg[Tanh[(p[[1]] + I p[[2]]) ^(x + I y)]],
{x, -5, 5}, {y, -4, 4},
Contours -> contours,
PlotPoints -> plotPts,
MaxRecursion -> maxRecurs,
Axes -> True,
ImageSize -> {300, 4/5 300},
AspectRatio -> 4/5,
PlotRange -> {-zRange, zRange},
ClippingStyle -> {LightGreen, Pink},
Exclusions -> {Cosh[(p[[1]] + I p[[2]]) ^(x + I y)] == 0},
PerformanceGoal -> "Quality"
],
{{p, {1, 1}}, Locator},
{{contours, 5}, 0, 80, 5},
{{plotPts, 25}, 10, 80, 5},
{{maxRecurs, 2}, 1, 10, 1},
{{zRange, 0.25}, 0, 10, 0.25}
]