Skip to content

Commit

Permalink
Merge pull request #61 from fusion-energy/removing_noise_from_log_plo…
Browse files Browse the repository at this point in the history
…t_zeros

added default interpolation to remove noise on log plots
  • Loading branch information
shimwell authored Nov 27, 2023
2 parents 772b74b + e12fe70 commit a3a0270
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/openmc_regular_mesh_plotter/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,11 @@ def plot_mesh_tally(
colorbar_kwargs : dict
Keyword arguments passed to :func:`matplotlib.colorbar.Colorbar`.
outline_kwargs : dict
Keyword arguments passed to :func:`matplotlib.pyplot.contour`.
Keyword arguments passed to :func:`matplotlib.pyplot.contour`. Defaults
to "colors": "black", "linestyles": "solid", "linewidths": 1
**kwargs
Keyword arguments passed to :func:`matplotlib.pyplot.imshow`
Keyword arguments passed to :func:`matplotlib.pyplot.imshow`. Defaults
to {"interpolation", "none"}.
Returns
-------
matplotlib.image.AxesImage
Expand Down Expand Up @@ -177,7 +179,11 @@ def plot_mesh_tally(
axes.set_xlabel(xlabel)
axes.set_ylabel(ylabel)

im = axes.imshow(data, extent=(x_min, x_max, y_min, y_max), **kwargs)
# zero values with logscale produce noise / fuzzy on the time but setting interpolation to none solves this
default_imshow_kwargs = {"interpolation": "none"}
default_imshow_kwargs.update(kwargs)

im = axes.imshow(data, extent=(x_min, x_max, y_min, y_max), **default_imshow_kwargs)

if colorbar:
fig.colorbar(im, **colorbar_kwargs)
Expand Down

0 comments on commit a3a0270

Please sign in to comment.