Announcing Dash Bio 1.0.0 πŸŽ‰ : a one-stop-shop for bioinformatics and drug development visualizations. area multiple plot error

Hi all

This is my code:

import pandas as pd
import as px
fig = px.area(df, x="x", y=['y1','y2','y3'])

As you can see my Y data are maximum 7. Why the results in the figure shows wrong values? why the vertical axis (value) do not show the correct values that are defined in above dictionary???

As I understood, ( pandas - Area multiple plots data error - Stack Overflow)
creates a stacked area plot, where each filled area corresponds to one column of the input data:

For example, at x = 5 , the stacked area plot reaches y = 18 = 5 + 6 + 7 .

Now the question is that What if I need to fill the area under the function like express.area whitout above problem ?

@Bijan, you can do it this way

fig = go.Figure() 
fig.add_scatter(x = df['x'], y=df['y1'], mode='lines',fill='tozeroy', fillcolor='red') 
fig.add_scatter(x = df['x'], y=df['y2'], mode='lines', fill='tonexty',fillcolor='green') 
fig.add_scatter(x = df['x'], y=df['y3'], mode='lines',fill='tonexty',fillcolor='blue')
1 Like

Thanks @alooksha. That’s the answer :+1: