Reputation: 2457
I create a basemap for US and want to fill in color with temperature value.
I want to fill the map with the color effect like the following picture.
But now I could only hand code the color value like 'red','orange' and 'purple' and could not get the effect.
Any suggestion to help me to start the search? Thanks.
Upvotes: 1
Views: 79
Reputation: 2998
Looks at this example. On this step you can change colorscale
parameter (and color changed on whole basemap).
I suggest you for first look at this forum answer and choose what colorscale you want the most (based on that page). Such colorscale="Jet"
.
Next, if that did not what you are looking for, then you can create a custom colorscale, specifying what color you want at each steps of colorscale.
Such this:
colorscale=[[0, 'rgb(166,206,227)'],[0.25, 'rgb(31,120,180)'],[0.45, 'rgb(178,223,138)']\
,[0.65, 'rgb(51,160,44)'],[0.85, 'rgb(251,154,153)'],[1, 'rgb(227,26,28)']]
But be warned! If you trying to update basemap example from plotly docs, check zmin
and zmax
. In example zmin=-5
and zmax=5
, so changed steps in custom colorscale if want custom colorscale:
colorscale=[[-5, 'rgb(166,206,227)'], [-3, 'rgb(31,120,180)'], [-1, 'rgb(178,223,138)']\
, [1, 'rgb(51,160,44)'], [3, 'rgb(251,154,153)'], [5, 'rgb(227,26,28)']]
Upvotes: 1