3 added 47 characters in body

I am trying to plot some Zernike polynomials, but I want all of them to be plotted by using the same colour scale from -1 to +1 (i.e. the range of these polynomials). I am using the following code:

DensityPlot[ZernikeR[nDensityPlot[
ZernikeR[n, m, Norm[{x, y}]] Cos[m ArcTan[x, y]], {x, -1, 1}, {y, -1,1}
, PlotRange -> {{-1, 1}, {-1, 1}, {-1, 1}}
, ColorFunction -> (Hue[2 (1 - #1)/3] &)
, PlotPoints -> 200
, PlotLegends -> Automatic
, RegionFunction -> Function[{x, y, z}, -1 < x^2 + y^2 < 1]]1]
]


I get what I want with some polynomials, e.g. when m=0 and n=2:

and not with others, e.g. when m=0 and n=4:

where the colour range goes down to -0.5 and not to -1. I want all polynomials to be coloured with a scale from -1 to 1, from blue to red. I haven't found a way to fix this. What am I missing? Thanks.

I am trying to plot some Zernike polynomials, but I want all of them to be plotted by using the same colour scale from -1 to +1 (i.e. the range of these polynomials). I am using the following code:

DensityPlot[ZernikeR[n, m, Norm[{x, y}]] Cos[m ArcTan[x, y]], {x, -1, 1}, {y, -1,1}, PlotRange -> {{-1, 1}, {-1, 1}, {-1, 1}},ColorFunction -> (Hue[2 (1 - #1)/3] &), PlotPoints -> 200,PlotLegends -> Automatic,RegionFunction -> Function[{x, y, z}, -1 < x^2 + y^2 < 1]]


I get what I want with some polynomials, e.g. when m=0 and n=2:

and not with others, e.g. when m=0 and n=4:

where the colour range goes down to -0.5 and not to -1. I want all polynomials to be coloured with a scale from -1 to 1, from blue to red. I haven't found a way to fix this. What am I missing? Thanks.

I am trying to plot some Zernike polynomials, but I want all of them to be plotted by using the same colour scale from -1 to +1 (i.e. the range of these polynomials). I am using the following code:

DensityPlot[
ZernikeR[n, m, Norm[{x, y}]] Cos[m ArcTan[x, y]], {x, -1, 1}, {y, -1,1}
, PlotRange -> {{-1, 1}, {-1, 1}, {-1, 1}}
, ColorFunction -> (Hue[2 (1 - #1)/3] &)
, PlotPoints -> 200
, PlotLegends -> Automatic
, RegionFunction -> Function[{x, y, z}, -1 < x^2 + y^2 < 1]
]


I get what I want with some polynomials, e.g. when m=0 and n=2:

and not with others, e.g. when m=0 and n=4:

where the colour range goes down to -0.5 and not to -1. I want all polynomials to be coloured with a scale from -1 to 1, from blue to red. I haven't found a way to fix this. What am I missing? Thanks.

2 swapped n with m

I am trying to plot some Zernike polynomials, but I want all of them to be plotted by using the same colour scale from -1 to +1 (i.e. the range of these polynomials). I am using the following code:

DensityPlot[ZernikeR[n, m, Norm[{x, y}]] Cos[m ArcTan[x, y]], {x, -1, 1}, {y, -1,1}, PlotRange -> {{-1, 1}, {-1, 1}, {-1, 1}},ColorFunction -> (Hue[2 (1 - #1)/3] &), PlotPoints -> 200,PlotLegends -> Automatic,RegionFunction -> Function[{x, y, z}, -1 < x^2 + y^2 < 1]]


I get what I want with some polynomials, e.g. when n=0m=0 and m=2n=2:

and not with others, e.g. when n=0m=0 and m=4n=4:

where the colour range goes down to -0.5 and not to -1. I want all polynomials to be coloured with a scale from -1 to 1, from blue to red. I haven't found a way to fix this. What am I missing? Thanks.

I am trying to plot some Zernike polynomials, but I want all of them to be plotted by using the same colour scale from -1 to +1 (i.e. the range of these polynomials). I am using the following code:

DensityPlot[ZernikeR[n, m, Norm[{x, y}]] Cos[m ArcTan[x, y]], {x, -1, 1}, {y, -1,1}, PlotRange -> {{-1, 1}, {-1, 1}, {-1, 1}},ColorFunction -> (Hue[2 (1 - #1)/3] &), PlotPoints -> 200,PlotLegends -> Automatic,RegionFunction -> Function[{x, y, z}, -1 < x^2 + y^2 < 1]]


I get what I want with some polynomials, e.g. when n=0 and m=2:

and not with others, e.g. when n=0 and m=4:

where the colour range goes down to -0.5 and not to -1. I want all polynomials to be coloured with a scale from -1 to 1. I haven't found a way to fix this. What am I missing? Thanks.

I am trying to plot some Zernike polynomials, but I want all of them to be plotted by using the same colour scale from -1 to +1 (i.e. the range of these polynomials). I am using the following code:

DensityPlot[ZernikeR[n, m, Norm[{x, y}]] Cos[m ArcTan[x, y]], {x, -1, 1}, {y, -1,1}, PlotRange -> {{-1, 1}, {-1, 1}, {-1, 1}},ColorFunction -> (Hue[2 (1 - #1)/3] &), PlotPoints -> 200,PlotLegends -> Automatic,RegionFunction -> Function[{x, y, z}, -1 < x^2 + y^2 < 1]]


I get what I want with some polynomials, e.g. when m=0 and n=2:

and not with others, e.g. when m=0 and n=4:

where the colour range goes down to -0.5 and not to -1. I want all polynomials to be coloured with a scale from -1 to 1, from blue to red. I haven't found a way to fix this. What am I missing? Thanks.

1

# Set a fixed colour scale with DensityPlot

I am trying to plot some Zernike polynomials, but I want all of them to be plotted by using the same colour scale from -1 to +1 (i.e. the range of these polynomials). I am using the following code:

DensityPlot[ZernikeR[n, m, Norm[{x, y}]] Cos[m ArcTan[x, y]], {x, -1, 1}, {y, -1,1}, PlotRange -> {{-1, 1}, {-1, 1}, {-1, 1}},ColorFunction -> (Hue[2 (1 - #1)/3] &), PlotPoints -> 200,PlotLegends -> Automatic,RegionFunction -> Function[{x, y, z}, -1 < x^2 + y^2 < 1]]


I get what I want with some polynomials, e.g. when n=0 and m=2:

and not with others, e.g. when n=0 and m=4:

where the colour range goes down to -0.5 and not to -1. I want all polynomials to be coloured with a scale from -1 to 1. I haven't found a way to fix this. What am I missing? Thanks.