added custom value-to-color mapper
This commit is contained in:
@@ -2,6 +2,7 @@ import re
|
|||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
import matplotlib
|
import matplotlib
|
||||||
|
import matplotlib as mpl
|
||||||
from matplotlib import pyplot as plt
|
from matplotlib import pyplot as plt
|
||||||
|
|
||||||
import warnings
|
import warnings
|
||||||
@@ -13,7 +14,7 @@ import numpy as np
|
|||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
from matplotlib import patches
|
from matplotlib import patches
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import matplotlib as mpl
|
|
||||||
from sfdata import SFDataFiles, sfdatafile, SFScanInfo
|
from sfdata import SFDataFiles, sfdatafile, SFScanInfo
|
||||||
import jungfrau_utils as ju
|
import jungfrau_utils as ju
|
||||||
|
|
||||||
@@ -299,3 +300,8 @@ def line_plot_with_colorbar(xs,ys,colors, cmap=plt.cm.viridis,
|
|||||||
|
|
||||||
# add colorbar
|
# 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