added custom value-to-color mapper
This commit is contained in:
@@ -2,6 +2,7 @@ import re
|
||||
from collections import defaultdict
|
||||
|
||||
import matplotlib
|
||||
import matplotlib as mpl
|
||||
from matplotlib import pyplot as plt
|
||||
|
||||
import warnings
|
||||
@@ -13,7 +14,7 @@ import numpy as np
|
||||
from tqdm import tqdm
|
||||
from matplotlib import patches
|
||||
from pathlib import Path
|
||||
import matplotlib as mpl
|
||||
|
||||
from sfdata import SFDataFiles, sfdatafile, SFScanInfo
|
||||
import jungfrau_utils as ju
|
||||
|
||||
@@ -298,4 +299,9 @@ def line_plot_with_colorbar(xs,ys,colors, cmap=plt.cm.viridis,
|
||||
ax.set_ylabel(ylabel)
|
||||
|
||||
# add colorbar
|
||||
fig.colorbar(s_m,ax=ax,ticks=colors,label=cbar_label,alpha=alpha)
|
||||
fig.colorbar(s_m,ax=ax,ticks=colors,label=cbar_label,alpha=alpha)
|
||||
|
||||
|
||||
def get_normalized_colormap(vmin, vmax, cmap=mpl.cm.viridis):
|
||||
norm = mpl.colors.Normalize(vmin=vmin, vmax=vmax)
|
||||
return lambda x: cmap(norm(x))
|
||||
|
||||
Reference in New Issue
Block a user