-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Background not transparant for plotting in spherical coordinates (no log). #2480
Comments
Hi, and welcome to yt! Thanks for opening your first issue. We have an issue template that helps us to gather relevant information to help diagnosing and fixing the issue. |
Hi! So this is happening because in the log valued, the background (0.0) values are getting turned into NaNs. I am looking now at the code for how we might address this so that it masks regardless of the geometry and logging. |
I was able to make the behavior consistent with this patch:
Would you like to issue a pull request with this? |
Not sure if desired, but the fix now gives a RuntimeWarning for the log-scale case. The non-log scale works as intended indeed! Let me know if you want to fix this warning before issuing a pull request.
|
Hmm, not sure how we might fix the warning. What happens if you use
-np.inf instead?
…On Fri, Mar 13, 2020 at 9:46 AM chverbeke ***@***.***> wrote:
Not sure if desired, but the fix now gives a RuntimeWarning for the
log-scale case. The non-log scale works as intended indeed! Let me know if
you want to fix this warning before issuing a pull request.
/Users/christine/.local/lib/python3.7/site-packages/matplotlib/colors.py:1110: RuntimeWarning: invalid value encountered in less_equal
mask |= resdat <= 0
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2480 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAVXO3KBESIWRMMDNYDFWTRHJBNPANCNFSM4LHBQ3JA>
.
|
Both cases (log and non-log) now give similar errors, see below (except for the RuntimeWarning which is only in the log-scale case). `/Users/christine/.local/lib/python3.7/site-packages/matplotlib/colors.py:1211: RuntimeWarning: invalid value encountered in greater ValueError Traceback (most recent call last) ~/yt/yt/visualization/plot_window.py in SlicePlot(ds, normal, fields, axis, *args, **kwargs) ~/yt/yt/visualization/plot_window.py in init(self, ds, axis, fields, center, width, axes_unit, origin, right_handed, fontsize, field_parameters, window_size, aspect, data_source) ~/yt/yt/visualization/plot_window.py in init(self, *args, **kwargs) ~/yt/yt/visualization/plot_window.py in init(self, data_source, bounds, buff_size, antialias, periodic, origin, oblique, right_handed, window_size, fields, fontsize, aspect, setup) ~/yt/yt/visualization/plot_window.py in _setup_plots(self) ~/yt/yt/visualization/plot_window.py in init(self, data, cbname, cblinthresh, cmap, extent, zlim, figure_size, fontsize, aspect, figure, axes, cax, mpl_proj, mpl_transform) ~/yt/yt/visualization/base_plot_types.py in _init_image(self, data, cbnorm, cblinthresh, cmap, extent, aspect) ~/.local/lib/python3.7/site-packages/matplotlib/figure.py in colorbar(self, mappable, cax, ax, use_gridspec, **kw) ~/.local/lib/python3.7/site-packages/matplotlib/colorbar.py in colorbar_factory(cax, mappable, **kwargs) ~/.local/lib/python3.7/site-packages/matplotlib/colorbar.py in init(self, ax, mappable, **kw) ~/.local/lib/python3.7/site-packages/matplotlib/colorbar.py in init(self, ax, cmap, norm, alpha, values, boundaries, orientation, ticklocation, extend, spacing, ticks, format, drawedges, filled, extendfrac, extendrect, label) ~/.local/lib/python3.7/site-packages/matplotlib/colorbar.py in draw_all(self) ~/.local/lib/python3.7/site-packages/matplotlib/colorbar.py in _config_axes(self, X, Y) ~/.local/lib/python3.7/site-packages/matplotlib/colorbar.py in update_ticks(self) ~/.local/lib/python3.7/site-packages/matplotlib/colorbar.py in _ticker(self, locator, formatter) ~/.local/lib/python3.7/site-packages/matplotlib/ticker.py in call(self) ~/.local/lib/python3.7/site-packages/matplotlib/ticker.py in tick_values(self, vmin, vmax) ValueError: arange: cannot compute length` |
When plotting a slice, the parts of the plot that do not belong to the dataset are usually plotted to be transparant (or you can set the background color yourself).
However, when using spherical coordinates and not have a log_scale, this is not the case and the background is always set to lowest value of the colorbar. This is the case whether you pick the limits of your colorbar yourself or not, and also whether you set the background color yourself or not.
The text was updated successfully, but these errors were encountered: