Iโm storing figures as .png and canโt figure out why the colors seem to change.
My full current code :
def dataplotter(stock, date):
# Create subplots and set plot grid size
fig = make_subplots(rows=2, cols=1, shared_xaxes=True,
vertical_spacing=0.01, subplot_titles=(f'{stock}', ''),
row_width=[0.2, 0.7])
fig.add_trace(go.Candlestick(x=df['Time'],
open=df['Open'],
high=df['High'],
low=df['Low'],
close=df['Close'],
increasing_line_color= '#2196F3', decreasing_line_color= '#000000',
increasing_fillcolor= '#2196F3', decreasing_fillcolor= '#000000' ))
fig.update_layout(height=900,
paper_bgcolor='rgba(000,000,000,0)', # Background outside
plot_bgcolor='rgba(0,0,0,0)')
# Remove rangeslider + set hovermode (crosshair)
fig.update_layout(xaxis_rangeslider_visible=False, hovermode='x unified')
fig.update_yaxes(ticks="outside", tickwidth=1, tickcolor='grey', ticklen=10, col=1)
# Add volume data in subplot
fig.add_trace(go.Bar(x=df.Time, y=df.Volume, yaxis='y2'))
fig.update_yaxes(gridcolor='rgba(211,211,211,211)', gridwidth=0.1, showspikes=True, spikedash='dot', spikemode='across',
spikecolor="black",spikesnap="cursor",spikethickness=1)
#fig.update_xaxes(showline=True, linewidth=2, linecolor='black')
fig.update_yaxes(showline=True, linewidth=2, linecolor='black')
fig.add_vline(x="2023-01-25 14:30:00+00:00", line_color='grey', line_dash="dash")
fig.show()
#Storage
time_string = datetime.datetime.now().strftime('%Y-%m-%d %H.%M')
filename = stock + ' ' + time_string + '.png'
print(filename)
fig.write_image(filename, scale=6, width=1920, height=1080)
dataplotter("SNOA", "2023-01-25")
Rendering in Jupyter Notebook looks like this:
While my exported image looks like this: