Skip to content

Square Heatmap ticks are off #1736

@cod3licious

Description

@cod3licious

I have plotly 4.1.0 installed and this code (in a Jupyter Notebook):

import numpy as np
import plotly.offline as py
import plotly.graph_objs as go

matrix = np.random.randn(10, 10)
ticks = ["tick %i" % i for i in range(10)]
data = [go.Heatmap(z=matrix, x=ticks, y=ticks, colorscale='Viridis')]
layout = go.Layout(
            hovermode='closest',
            autosize=True,
            xaxis=dict(zeroline=False),
            yaxis=dict(zeroline=False, autorange='reversed', scaleanchor="x", scaleratio=1)
         )
fig = go.Figure(data=data, layout=layout)
py.iplot(fig)

Produces this plot:
Screenshot 2019-08-23 at 14 36 18

I think there really shouldn't be this space between the y ticks and colorbar and the heatmap. Without the yaxis scaleanchor="x" it looks fine, but I really want a square heatmap... Is there any setting I'm missing or is this a bug?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions