I am using plotly on python. I have a legend which is a colour scale 0-100%. Currently 100 is at the top and 0 at the bottom. I want 100 to be the bottom and 0 the top. Is this possible?
import pandas as pd
import plotly.express as px
import numpy as np
df = pd.DataFrame(
{
"x": np.linspace(0, 10, 20),
"y": np.cos(np.linspace(0, 10, 20)),
"color": np.linspace(0, 1, 20),
}
)
px.scatter(df, x="x", y="y", color="color").update_layout(
coloraxis={
"colorbar": {
"tickmode": "array",
"tickvals": np.linspace(0, 1, 5),
"ticktext": np.linspace(1, 0, 5),
}
}
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.