Hide Colormap on Choropleth Map in Python

How can I hide a colormap next to a Choropleth map in Python? I’ve found mentions of “hidescale” and “hidelegend”, but I don’t know where to insert them in my code! Thank you.

ufo_scale = [[0, 'rgb(255, 255, 255)'],[1, 'rgb(0, 204, 102)']]

data = [ dict(
        type='choropleth',
        colorscale = ufo_scale,
        autocolorscale = False,
        locations = us_states,
        z = ufo_count,
        locationmode = 'USA-states',
        marker = dict(
            line = dict (
                color = 'rgb(255, 255, 255)',
                width = 2
            ) ),
        ) ]

layout = dict(
        title = 'UFO Sightings Reported in United States (1900-2014)',
        geo = dict(
            scope='usa',
            projection=dict( type='albers usa' ),
            showlakes = True,
            lakecolor = 'rgb(255, 255, 255)'),
             )

figure = dict( data=data, layout=layout )
iplot(figure)
1 Like

showscale = True should do the trick.

Sometimes the showscale=False configuration fails, due to a plotly bug, but this hack from another plotly forum answer fixed it for me: Hiding Color Scale / Color Legend