Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Identical axis labels removed in heatmap (need new category mode or axis type)

See original GitHub issue

Consider the following plot (as JSON):

{'layout': {u'margin': {u'r': 60, u'b': 60, u't': 60, u'l': 60}}, 'data': [{u'zmax': 1.0054633722786, u'colorscale': u'Viridis', u'zmin': -1.4410649905944, u'y': [u'a', u'b', u'a'], u'x': [u'd', u'd'], u'z': [[-0.50443826056116, -0.55385051210768], [-0.52712315391279, 1.0054633722786], [-1.4410649905944, 0.50761805140936]], u'type': u'heatmap'}]}

Note how there are identical axis labels in the JSON on the x and y-axis. This leads to an incorrect rendering: screen shot 2017-03-24 at 4 09 04 pm

It appears the identical labels get removed automatically.

Additional context here and here.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:4
  • Comments:17 (6 by maintainers)

github_iconTop GitHub Comments

cpsievertcommented, Mar 24, 2017

Another workaround would be to use ticktext/tickvals:

LeUser111commented, Apr 2, 2019

Hey guys!

A little late to the party - however we’ve just run into this exact issue with the stacked-bar-chart. We are trying to display the properties of tools that are used in a process. Of course tools can be used multiple times.

Thanks to the solution of @cpsievert it works like a charm! (Thank you very much!).

Here’s a simple example where I just mixed the example code for stacked-bar-charts with the solution proposed by @cpsievert :

var trace1 = { 
  y: [20, 14, 23],
  name: 'Primary Processing',
  type: 'bar'

var trace2 = { 
  y: [12, 18, 29],
  name: 'Secondary Processing',
  type: 'bar'

var data = [trace1, trace2];
var layout = {barmode: 'stack', "xaxis": {
    "ticktext": ["tool1", "tool2", "tool1"], "tickvals": [0, 1, 2]

Plotly.newPlot("graph", data, layout);

The reason why I’m posting this:

Would you kindly consider adding this information to the official documentation? (e.g. here)

As this issue shows it’s not an uncommon requirement and since there is a practical solution for this it would be great if it was described close to the charts themselves - maybe as an additional example (e.g. “bars with multiple occurrences of x-values”).

(Sorry if it’s already there and I just missed it!)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Identical axis labels removed in heatmap (need new category mode ...
Identical axis labels removed in heatmap (need new category mode or axis type)
Read more >
Change axis labels for seaborn heatmap - Stack Overflow
I have axis labels ABCDEFGHIJKLMNO and would like to change them to the labels 0.45 0.90 1.35 1.80 2.25 2.70 3.15 3.60 4.05...
Read more >
How to include labels in sns heatmap
I got your problem like this way: You want to show labels on the x and y-axis on the seaborn heatmap. So for...
Read more >
Change axis options | ThoughtSpot Software
Apply conditional formatting · Click the Conditional formatting option in the axis menu. Add conditional formatting · To specify a different color of...
Read more >
Axes in R - Plotly
Set axis title text with Plotly. Axis titles are automatically set to the column names when using Plotly with a data frame as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found