Skip to content

Commit 4cc984b

Browse files
authored
Merge pull request #289 from xylar/fix-log-norm
Fix planar plots with log norm
2 parents a1a8519 + d8c9a2d commit 4cc984b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

polaris/viz/planar.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@ def plot_horiz_field(ds_mesh, field, out_file_name=None, # noqa: C901
4141
The title of the plot
4242
4343
vmin : float, optional
44-
The minimum values for the colorbar
44+
The minimum values for the colorbar; if provided, must be positive if
45+
``cmap_scale == 'log'``
4546
4647
vmax : float, optional
47-
The maximum values for the colorbar
48+
The maximum values for the colorbar; if provided, must be positive if
49+
``cmap_scale == 'log'``
4850
4951
show_patch_edges : boolean, optional
5052
If true, patches will be plotted with visible edges
@@ -165,8 +167,10 @@ def plot_horiz_field(ds_mesh, field, out_file_name=None, # noqa: C901
165167

166168
if cmap_scale == 'log':
167169
pcolor_kwargs['norm'] = LogNorm(
168-
vmin=max(1e-10, vmin), vmax=vmax, clip=False
170+
vmin=vmin, vmax=vmax, clip=False
169171
)
172+
pcolor_kwargs.pop('vmin', None)
173+
pcolor_kwargs.pop('vmax', None)
170174

171175
if figsize is None:
172176
width = ds_mesh.xCell.max() - ds_mesh.xCell.min()

0 commit comments

Comments
 (0)