Skip to content

Commit

Permalink
Merge pull request #59 from ttricco/log_vmin_vmax
Browse files Browse the repository at this point in the history
vmin and vmax play nicely with log_scale
  • Loading branch information
ttricco authored May 23, 2023
2 parents 2efa359 + 8ac51f4 commit e5aa0bd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sarracen/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ def render(data: 'SarracenDataFrame', target: str, x: str = None, y: str = None,
Number of pixels present in the final image.
xlim, ylim: tuple of float, optional
The starting and ending corners of the final 2D image.
vmin, vmax: float, optional
Lower and upper limits of the range of values for the colour bar.
cmap: str or Colormap, optional
The color map to use when plotting a 2D image.
cbar: bool, optional
Expand Down Expand Up @@ -273,7 +275,9 @@ def render(data: 'SarracenDataFrame', target: str, x: str = None, y: str = None,
kwargs.setdefault("origin", 'lower')
kwargs.setdefault("extent", [xlim[0], xlim[1], ylim[0], ylim[1]])
if log_scale:
kwargs.setdefault("norm", LogNorm(clip=True))
kwargs.setdefault("norm", LogNorm(clip=True, vmin=kwargs.get('vmin'), vmax=kwargs.get('vmax')))
kwargs.pop("vmin", None)
kwargs.pop("vmax", None)

graphic = ax.imshow(img, cmap=cmap, **kwargs)
if rotation is not None and data.get_dim() == 3:
Expand Down

0 comments on commit e5aa0bd

Please sign in to comment.