Skip to content

Commit

Permalink
Revert colormap unavailable in older matplotlib.
Browse files Browse the repository at this point in the history
The cividis colormap was introduced in matplotlib 2.2, but FlowCal
supports back to matplotlib version 2.0. This fix reverts cividis
to a grayscale colormap available in matplotlib 2.0.
  • Loading branch information
JS3xton committed Jan 14, 2021
1 parent d93562b commit 33ab721
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
16 changes: 8 additions & 8 deletions examples/analyze_excel_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@
# in the context of accessory matplotlib functions to modify the axes
# limits and labels and to add a legend, among other things.

# Color each histogram according to its corresponding DAPG concentration.
# Use a perceptually uniform colormap (cividis), and transition among
# colors using a logarithmic normalization, which comports with the
# logarithmically spaced DAPG concentrations.
cmap = mpl.cm.get_cmap('cividis')
norm = mpl.colors.LogNorm(vmin=1e0, vmax=500)
colors = [cmap(norm(dapg_i)) if dapg_i > 0 else cmap(0.0)
for dapg_i in dapg]
# Color each histogram according to its DAPG concentration. Linearize the
# color transitions using a logarithmic normalization to match the
# logarithmic spacing of the DAPG concentrations. (Concentrations are also
# augmented slightly to move the 0.0 concentration into the log
# normalization range.)
cmap = mpl.cm.get_cmap('gray_r')
norm = mpl.colors.LogNorm(vmin=1e0, vmax=3500.)
colors = [cmap(norm(dapg_i+4.)) for dapg_i in dapg]

plt.figure(figsize=(6,3.5))
FlowCal.plot.hist1d([samples[s_id] for s_id in sample_ids],
Expand Down
16 changes: 8 additions & 8 deletions examples/analyze_mef.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,14 +445,14 @@
# in the context of accessory matplotlib functions to modify the axes
# limits and labels and to add a legend, among other things.

# Color each histogram according to its corresponding DAPG concentration.
# Use a perceptually uniform colormap (cividis), and transition among
# colors using a logarithmic normalization, which comports with the
# logarithmically spaced DAPG concentrations.
cmap = mpl.cm.get_cmap('cividis')
norm = mpl.colors.LogNorm(vmin=1e0, vmax=500)
colors = [cmap(norm(dapg_i)) if dapg_i > 0 else cmap(0.0)
for dapg_i in dapg]
# Color each histogram according to its DAPG concentration. Linearize the
# color transitions using a logarithmic normalization to match the
# logarithmic spacing of the DAPG concentrations. (Concentrations are also
# augmented slightly to move the 0.0 concentration into the log
# normalization range.)
cmap = mpl.cm.get_cmap('gray_r')
norm = mpl.colors.LogNorm(vmin=1e0, vmax=3500.)
colors = [cmap(norm(dapg_i+4.)) for dapg_i in dapg]

plt.figure(figsize=(6,3.5))
FlowCal.plot.hist1d(samples,
Expand Down
16 changes: 8 additions & 8 deletions examples/analyze_no_mef.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,14 @@
# in the context of accessory matplotlib functions to modify the axes
# limits and labels and to add a legend, among other things.

# Color each histogram according to its corresponding DAPG concentration.
# Use a perceptually uniform colormap (cividis), and transition among
# colors using a logarithmic normalization, which comports with the
# logarithmically spaced DAPG concentrations.
cmap = mpl.cm.get_cmap('cividis')
norm = mpl.colors.LogNorm(vmin=1e0, vmax=500)
colors = [cmap(norm(dapg_i)) if dapg_i > 0 else cmap(0.0)
for dapg_i in dapg]
# Color each histogram according to its DAPG concentration. Linearize the
# color transitions using a logarithmic normalization to match the
# logarithmic spacing of the DAPG concentrations. (Concentrations are also
# augmented slightly to move the 0.0 concentration into the log
# normalization range.)
cmap = mpl.cm.get_cmap('gray_r')
norm = mpl.colors.LogNorm(vmin=1e0, vmax=3500.)
colors = [cmap(norm(dapg_i+4.)) for dapg_i in dapg]

plt.figure(figsize=(6,3.5))
FlowCal.plot.hist1d(samples,
Expand Down

0 comments on commit 33ab721

Please sign in to comment.