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:
CHT_Transparent

This is how I want it to look:
CHT_Not_Transparent

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

Thank you very much in advance.

Regards,

Jasper

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 plotly.express as px
df = px.data.tips()
fig = px.area(df, x=“total_bill”, y=“tip”, color=“sex”, fill=“tozeroy”)
fig.show()

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.