Soerendip
Soerendip

Reputation: 9148

How to change the colorbar range in plotly express graph?

How can I change the color range in ploty express scatter plots?

import plotly.express as px

...

fig = px.scatter(data, 
                 x="X-coord", 
                 y="Y-coord", 
                 animation_frame="Timepoint",
                 color="Fraction", 
                 hover_name="Compound",
                 size_max=10,
                 size='Fraction')

enter image description here

I want the colorbars to show a range from 0 to 1.

Upvotes: 15

Views: 15565

Answers (1)

Soerendip
Soerendip

Reputation: 9148

You can add range_color=(0,1) to the keywords of px.scatter.

Upvotes: 16

Related Questions