Skip to content

Commit

Permalink
quick2d cmap added (#1090)
Browse files Browse the repository at this point in the history
  • Loading branch information
kameyer226 committed Jul 29, 2022
1 parent f86bf00 commit 773ad71
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
- `Data.__getitem__` supports array slicing
- `artists.interact2D` supports `cmap` kwarg.
- iPython integration: autocomplete includes axis, variable, and channel names
- `artists.quick2D`: supports `cmap` kwarg.
- Allow `create_variable` and `create_channel` to create compressed datasets

### Changed
Expand Down
18 changes: 11 additions & 7 deletions WrightTools/artists/_quick.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ def quick2D(
at={},
channel=0,
*,
cmap=None,
contours=0,
pixelated=True,
dynamic_range=False,
Expand All @@ -190,6 +191,8 @@ def quick2D(
at : dictionary (optional)
Dictionary of parameters in non-plotted dimension(s). If not
provided, plots will be made at each coordinate.
cmap : Colormap
Colormap to use. If None, will use "default" or "signed" depending on channel values.
channel : string or integer (optional)
Name or index of channel to plot. Default is 0.
contours : integer (optional)
Expand Down Expand Up @@ -228,13 +231,14 @@ def quick2D(
chopped = data.chop(xaxis, yaxis, at=at, verbose=False)
# colormap
# get colormap
if data.channels[channel_index].signed:
cmap = "signed"
else:
cmap = "default"
cmap = colormaps[cmap]
cmap.set_bad([0.75] * 3, 1.0)
cmap.set_under([0.75] * 3, 1.0)
if cmap is None:
if data.channels[channel_index].signed:
cmap = "signed"
else:
cmap = "default"
cmap = colormaps[cmap]
cmap.set_bad([0.75] * 3, 1.0)
cmap.set_under([0.75] * 3, 1.0)
# fname
if fname is None:
fname = data.natural_name
Expand Down

0 comments on commit 773ad71

Please sign in to comment.