title: Plotly bar chart - change color based on positive/negative value - python
body: <p>I have the following code which plots a bar chart (1 series), but I need the bars to be coloured blue if the 'Net' value is positive, and red if its negative:</p>
  <pre><code>import pandas as pd
  import plotly.graph_objects as go
  
  df = pd.DataFrame({
       'Net':[15,20,-10,-15], 
       'Date':['07/14/2020','07/15/2020','07/16/2020','07/17/2020']
  })
  
  df['Date'] = pd.to_datetime(df['Date'])
  fig = go.Figure(data=[go.Bar(name='Net', x=df['Date'], y=df['Net'])])
  fig.update_layout(barmode='stack')
  fig.show()
  </code></pre>