While I’ve been able to find plenty of documentation as to how to create subplots, as well as documentation as to how to create plots with multiple traces (doubt I need to site a source here, that’s fairly common), I’ve been alluded as to how to add a trace to a specific subplot. This is my code:
trace0=tracelist trace1=tracelist trace2=tracelist trace3=tracelist #guide for making subplots in python using plotly: https://plot.ly/python/subplots/ fig = tools.make_subplots(rows=2, cols=2, shared_yaxes=True) fig = tools.make_subplots(rows=2, cols=2, subplot_titles=(titles,titles,titles,titles), horizontal_spacing=0.05,vertical_spacing=0.1, shared_yaxes=True) fig.append_trace(trace0, 1, 1) fig.append_trace(trace1, 1, 2) fig.append_trace(trace2, 2, 1) fig.append_trace(trace3, 2, 2) fig['layout']['xaxis1'].update(range=[-3, 7]) fig['layout']['xaxis3'].update(title='Pass',range=[-5,8],dtick=2) fig['layout']['xaxis4'].update(title='Pass') fig['layout']['yaxis1'].update(title='ytitle1') fig['layout']['yaxis2'].update(title='ytitle2') fig['layout'].update(height=800, width=1000, showlegend=False, title='Title') py.iplot(fig)
Whenever traces are added to a plot, it’s usually performed by creating a list of traces called ‘data,’ which is utilized when creating ‘fig.’ However, due to the nature of how subplots are created, I don’t see any way to apply that approach.
My goal is simply to add two horizontal lines to each of the four sub-plots; how exactly should I go about it? Is there some way I can utilize the ‘update’ method?