You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am getting unexpected behavior from limits containing zero when using pub_plot:
Here's an example trying to plot a sample file (created by cdo -f nc4 -topo,r24x12 topo.nc) with version 1.1.6.
python -c 'import nctoolkit;nctoolkit.open_data("topo.nc").pub_plot(var="topo",out="test0.png",mid_point=1,limits=[0,2])' gives a plot that does not have limits at [0,2].
python -c 'import nctoolkit;nctoolkit.open_data("topo.nc").pub_plot(var="topo",out="test1.png",mid_point=1,limits=[-2,2])' also does not have limits at [-2,2].
However, python -c 'import nctoolkit;nctoolkit.open_data("topo.nc").pub_plot(var="topo",out="test2.png",mid_point=0,limits=[-2,2])' behaves as expected.
My guess is that moving lines 464-466 in static_plot.py out of the try loop would help, and that mid_point=0 happens to work because of lines 530-533.
The text was updated successfully, but these errors were encountered:
After some thought, the mid_point arg is poorly designed, and it probably should not exist.
In your case, you should probably specify the colour scale:
ds.pub_plot(var="topo",out="test0.png",mid_point=1,limits=[0,2], colours = "RdBu_r")
This is probably the easiest way to get the desired output.
I have now made some changes to the development version.
mid_point is no longer an argument.
If the limits is supplied, and the colour scale passes through zero, the colour scale will be forced to be symmetrical around zero. i.e. if you supply [-2, 10], it would be reset to [-10, 10].
I am getting unexpected behavior from limits containing zero when using
pub_plot
:Here's an example trying to plot a sample file (created by
cdo -f nc4 -topo,r24x12 topo.nc
) with version 1.1.6.python -c 'import nctoolkit;nctoolkit.open_data("topo.nc").pub_plot(var="topo",out="test0.png",mid_point=1,limits=[0,2])'
gives a plot that does not have limits at [0,2].python -c 'import nctoolkit;nctoolkit.open_data("topo.nc").pub_plot(var="topo",out="test1.png",mid_point=1,limits=[-2,2])'
also does not have limits at [-2,2].However,
python -c 'import nctoolkit;nctoolkit.open_data("topo.nc").pub_plot(var="topo",out="test2.png",mid_point=0,limits=[-2,2])'
behaves as expected.My guess is that moving lines 464-466 in
static_plot.py
out of thetry
loop would help, and that mid_point=0 happens to work because of lines 530-533.The text was updated successfully, but these errors were encountered: