在plotly.figure_factory.create_choropleth
中使用对数刻度颜色编码时,在颜色代码图例中显示actual
值的最佳方式是什么
以下是示例代码:
import plotly.figure_factory as ff
fips = df['fips']
values = np.log10(df['values'])
endpts = list(np.linspace(0, 4, len(colorscale) - 1))
fig = ff.create_choropleth(fips=fips, values=values, scope = ['usa'], binning_endpoints = endpts)
以下是我目前拥有的:
以下是我想要的:
与上述地图完全相同,只是图例中显示的是实际数字,而不是log10(值)。例如,我希望看到的不是0.0-0.5和0.5-1.0(表示10^0-10^1/2和10^1/2-10^1),而是:1-3、4-10等等
我不熟悉Plotly API,因为您没有提供最低限度的工作示例,所以我很难进行测试,但我很有信心您可以指定一个colormap。如果是这样,那么您可以在对数比例下转换颜色贴图,同时以线性比例输入数字
相关问题 更多 >
编程相关推荐