saibot_90
saibot_90

Reputation: 37

Horizontal colorscale Plotly Express

Is there a possibilty in Plotly Express to set the color scale horizontal under the graph. Here is my code:

import plotly.express as px
fig = px.scatter(df, x="year", y="Temperature", trendline="ols",
                 color="Temperature", color_continuous_scale=px.colors.sequential.Hot_r)

I tried: fig.update_coloraxes(colorbar_orientation="h") but just get an error.

Upvotes: 0

Views: 1364

Answers (1)

jonasfrederic
jonasfrederic

Reputation: 19

You just need to add:

fig.update_layout(coloraxis=dict(colorbar=dict(orientation='h', y=-0.15)))

Upvotes: 1

Related Questions