def style_plot(figure): """Provides basic layout attributes for given figure.""" figure.update_layout( title=f"Relative growth of stock prices for {df.index[0].strftime('%B %Y')} - " \ + f"{df.index[-1].strftime('%B %Y')}", hovermode="x", # D3 formatting. Adds a percentage sign and rounds numbers # to 1 decimal after decimal point. yaxis1=dict(ticksuffix=" %", tickformat="+.1f", title="Relative growth"), yaxis2=dict( fixedrange=True, overlaying="y", range=[0, 1], visible=False, ), xaxis=dict(title="Date") ) style_plot(ref_date_fig)