I am quite new to Plotly so bear with me if these are simple questions, the first is that I cannot seem to get square contour plots. My code is the following;
FYI n and k and both ndarrays with dimensions 31 and A is a ndarray with dimensions (31x31)
Also I canβt seem to change the colours of the plot, as you can see I have tried to use colourscale=βplasmaβ but I am getting the same as the default.
The Plotly contour trace has no attribute scaleratio. Choosing an adequate layout width and height you can adjust the size of plot as you want. When you experiment a new trace just check https://plot.ly/python/reference
and choose from the left menu the corresponding trace to see its attributes.
To convert a matplotlib (like plasma) or cmocean colormap to a Plotly colorscale
use this function:
import cmocean
import numpy as np
import matplotlib.cm as cm
def mpl_to_plotly(cmap, pl_entries):
h=1.0/(pl_entries-1)
pl_colorscale=[]
for k in range(pl_entries):
C=map(np.uint8, np.array(cmap(k*h)[:3])*255)
pl_colorscale.append([round(k*h,2), 'rgb'+str((C[0], C[1], C[2]))])
return pl_colorscale
plotly_plasma=mpl_to_plotly(cm.plasma, 11)