Commit bb07fe12 authored by Kelvin Loh's avatar Kelvin Loh

Adds the plotly testing script.

parent 2f43a91c
Pipeline #25629 passed with stages
in 8 minutes and 16 seconds
......@@ -174,12 +174,17 @@ if plotly_available:
def convert_cmap_list_mpl_plotly(mpl_cmap_name, N=255):
cmap_mpl = matplotlib.cm.get_cmap(mpl_cmap_name)
cmap_mpl_arr = matplotlib.colors.makeMappingArray(N, cmap_mpl)
level = np.linspace(0, 1, N)
cmap_plotly_linear = [(level, convert_colormap_mpl_plotly(cmap_mpl))
for level, cmap_mpl in zip(level,
cmap_mpl_arr)]
if isinstance(mpl_cmap_name, str):
cmap_mpl = matplotlib.cm.get_cmap(mpl_cmap_name)
cmap_mpl_arr = matplotlib.colors.makeMappingArray(N, cmap_mpl)
level = np.linspace(0, 1, N)
cmap_plotly_linear = [(level, convert_colormap_mpl_plotly(cmap_mpl))
for level, cmap_mpl in zip(level,
cmap_mpl_arr)]
else:
assert(isinstance(mpl_cmap_name, list))
# Do not do any conversion if it's already a list
cmap_plotly_linear = mpl_cmap_name
return cmap_plotly_linear
......
......@@ -1612,6 +1612,7 @@ def mask_interpolate(coords, values, a=None, method='nearest', oversampling=3):
range(len(cmin)))
grid = tuple(np.ogrid[dims])
img = interpolate.griddata(coords, values, grid, method)
img = img.astype(np.float_)
mask = np.mgrid[dims].reshape(len(cmin), -1).T
# The numerical values in the following line are optimized for the common
# case of a square lattice:
......@@ -1793,7 +1794,8 @@ def _map_plotly(syst, img, colorbar, _max, _min, vmin, vmax, overflow_pct,
contour_object.y = np.linspace(_min[1],_max[1],img.shape[1])
contour_object.zsmooth = False
contour_object.connectgaps = False
contour_object.colorscale = _p.convert_cmap_list_mpl_plotly(cmap)
cmap = _p.convert_cmap_list_mpl_plotly(cmap)
contour_object.colorscale = cmap
contour_object.zmax = vmax
contour_object.zmin = vmin
contour_object.hoverinfo = 'none'
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment