title: Python Plotly Express: How to conditionally fill an area plot?
body: <p>I want to plot a time-series area plot, where positive (&gt;= 0) values are filled in one colour and negative (&lt; 0) values are filled in another.</p>
  <p>Taking this example:</p>
  <pre><code>import pandas as pd
  import numpy as np
  import plotly.express as px
  
  df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv').assign(
      PnL = lambda x: x['AAPL.Close'] - 100
  )
  px.area(
      data_frame = df,
      x = 'Date',
      y = 'PnL',
      width = 500,
      height = 300
  )
  </code></pre>
  <p><a href="https://i.stack.imgur.com/AhOrw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AhOrw.png" alt="figure_1" /></a></p>
  <p>I want the parts where PnL goes below 0 to be filled red.</p>
  <p>So this is what I tried:</p>
  <pre><code>import pandas as pd
  import numpy as np
  import plotly.express as px
  
  df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv').assign(
      PnL = lambda x: x['AAPL.Close'] - 100
  )
  df['sign'] = np.where(df['PnL'] &gt;= 0, 'positive', 'negative')
  px.area(
      data_frame = df,
      x = 'Date',
      y = 'PnL',
      color = 'sign',
      color_discrete_map = {
          'positive': 'steelblue',
          'negative': 'crimson'
      },
      width = 500,
      height = 300
  )
  </code></pre>
  <p>But this gives me:</p>
  <p><a href="https://i.stack.imgur.com/EpFZd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EpFZd.png" alt="figure_2" /></a></p>
  <p>Which is not exactly what I'm looking for. What's the best way to do this?</p>