Here is my HeatMap plot function:
def plot_heatmap(alphas, k_list, title_prefix="", years=["Y2013", "Y2014"]):
data = [
Heatmap(
name = "",
z = alphas,
x = years,
y = k_list,
hoverongaps = False,
zauto = False,
zmin = zmin,
zmax = zmax,
colorscale = color_custom,
colorbar = dict(
title = "Alpha Value",
thicknessmode = "pixels",
thickness = 50,
yanchor = "top",
y = 1,
len = 480,
lenmode = "pixels",
ticks = "outside",
dtick = zmax / 10
)
)
]
fig = Figure(
data = data,
layout = Layout(
width = 640,
height = round(60 * len(k_list)) if round(60 * len(k_list)) > 640 else 640,
# autosize = True,
title = title_prefix + " | HeatMap : alphas",
)
)
fig.data[0]['hoverinfo'] = 'all'
fig['layout']['yaxis']['scaleanchor'] = 'x'
iplot(fig)
Right now, my workaround is height = round(60 * len(k_list)) if round(60 * len(k_list)) > 640 else 640,
in the *Layout
object.
The result is like this:
I don't want to see the grey parts on the plot; how can I do that?
I think that for some reason Plotly takes your years
input to be numerical. You can make this variable explicitly categorical by adding
fig['layout']['xaxis']['type'] = 'category'