How to make the fill in a Plotly Express Area chart solid (non-transparent)

When you use the Plotly Express Area chart function you get by default an area chart with a solid line and a transparent fill. Is it possible to make the fille solid.

I managed to achieve this by using Plotly GO without using the px.area function, but I would prefere to achieve it by using Plotly express followed by an update_layout statement or similar.

This is what I get by using default plotly express px.area:

This is how I want it to look:

You can ignore the differences besides the transparency of the fill.

Thank you very much in advance.



1 Like

Can you attach your expected output

1 Like

Thanks for your suggestion! I added images to the original post.

HI @jdefockert,

@vestland has a great answer on a similar quiestion here:

@aimped - thanks that is exactly what I was looking for!

1 Like

In Plotly Express, you can make the fill in an Area chart solid by specifying the fill argument with value 'tozeroy' in the px.area function. Here’s an example:
import as px
df =
fig = px.area(df, x=“total_bill”, y=“tip”, color=“sex”, fill=“tozeroy”)

This will create an Area chart with solid fill from the x-axis to the line. I have listed the example to fill polty express area chart solid non transparent. You can also take help from generalüberholte iphones for more and updated information about it.