Contour plot with positive and negative values
You should avoid using N
as a variable name as N
is a reserved word for a function that gives the numerical value of an expression to a desired precision.
The smoothness can be improved by increasing the default number of points used to create the contours (PlotPoints
). The color scheme can be changed by the ColorFunction
option. To make the level '0' the maximum you'd want to use -Abs[...]
:
ContourPlot[-Abs[(1 - c n z)/(n z - c n z^2) /. {c -> .01}], {n, 2, 50}, {z, 0, 20},
PlotPoints -> 100, ColorFunction -> GrayLevel]
To show a "hill" it might be better to use Plot3D
:
Show[Plot3D[-Abs[(1 - c n z)/(n z - c n z^2) /. {c -> .01}], {n, 2,
50}, {z, 0, 20},
PlotPoints -> 100, ColorFunction -> GrayLevel],
Graphics3D[{Red,
Line[Table[{n, 1/(c n) /. c -> 0.01, 0}, {n, 5, 50}]]}]]
You can also use DensityPlot
with ColorData[{"GrayTones", "Reversed"}]
as the color function:
c = .01;
DensityPlot[Abs[(1 - c n z)/(n z - c n z^2) ],
{n, 2, 50}, {z, 0, 20},
PlotPoints -> 100,
ColorFunction -> ColorData[{"GrayTones", "Reversed"}]]
Using ColorFunction -> (GrayLevel[1 - #] &)
gives a similar picture.