question-mark
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.

autocolorscale doesn't seem to pickup on diverging numberlines

See original GitHub issue

I have a data set for employment in the US. When I use autocolorscale with a diverging set (i.e numbers that are negative and positive), many positive numbers get picked up as negative ones.

Below is a Choropleth figure that this can be tested on. Only a few numbers are negative, yet the colorscale makes many of the states appear negative. This could easily be fixed if a zero could be applied to the scale, rather than percentage of zmin/zmax.

Choropleth({
    'autocolorscale': True,
    'hoverinfo': 'location+text',
    'locationmode': 'USA-states',
    'locations': [AL, AK, AZ, AR, CA, CO, CT, DE, DC, FL, GA, HI, ID, IL, IN, IA,
                  KS, KY, LA, ME, MD, MA, MI, MN, MS, MO, MT, NE, NV, NH, NJ, NM,
                  NY, NC, ND, OH, OK, OR, PA, RI, SC, SD, TN, TX, UT, VT, VA, WA,
                  WV, WI, WY, GU, PR, VI],
    'marker': {'line': {'color': '#ffffff', 'width': 1}},
    'text': [9,580, -5,330, 51,060, 8,810, 728,430, 47,620, -11,860, 1,930, 5,840,
             197,000, 89,120, 870, 22,140, 24,040, 27,230, 550, -5,070, 6,780,
             -20,110, 2,790, 23,430, 68,160, 63,950, 27,870, 2,190, 30,830, 6,000,
             2,230, 39,290, 4,900, 52,120, -4,360, 110,220, 67,370, -8,530, 32,750,
             -13,890, 39,850, 34,590, 720, 29,640, 1,950, 22,710, 145,630, 35,770,
             440, 29,360, 119,500, -8,910, 20,160, -8,140, 0, -7,580, 170],
    'z': [9580.0, -5330.0, 51060.0, 8810.0, 728430.0, 47620.0, -11860.0, 1930.0,
          5840.0, 197000.0, 89120.0, 870.0, 22140.0, 24040.0, 27230.0, 550.0,
          -5070.0, 6780.0, -20110.0, 2790.0, 23430.0, 68160.0, 63950.0, 27870.0,
          2190.0, 30830.0, 6000.0, 2230.0, 39290.0, 4900.0, 52120.0, -4360.0,
          110220.0, 67370.0, -8530.0, 32750.0, -13890.0, 39850.0, 34590.0, 720.0,
          29640.0, 1950.0, 22710.0, 145630.0, 35770.0, 440.0, 29360.0, 119500.0,
          -8910.0, 20160.0, -8140.0, 0.0, -7580.0, 170.0]
})

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
etpinardcommented, Feb 21, 2019

Going to close this thing.

@mbkupfer if the cmid: 0 solution doesn’t cut for you and you can think of a better one, please open another issue. Thank you!

0reactions
etpinardcommented, Feb 19, 2019

Essentially closed by https://github.com/plotly/plotly.js/pull/3549

Adding cmd: 0 should do the trick.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Absolute value and number lines (video) | Khan Academy
One easy way to think of absolute value is the distance it is from zero. To do that, a number line comes in...
Read more >
How to Use a Number Line | Study.com
Doesn't that sound crazy? A number line is a wonderful tool to help you with math. It's a straight line with numbers that...
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found