Hi,
Just made a basic 2 by 2 subplot:
fig = make_subplots(
rows=2, cols=2,
subplot_titles=[
'Receiver Operating Characteristic',
'TPR vs FPR',
'Precision-Recall Curve',
'Precision vs Recall'
],
)
and after adding traces to each subplot I want to update the layout for each subplot, common properties like plot width, height, xaxis, yaxis, title, etc.
fig.update_layout(
{
'xaxis':{'range': [0, 1], 'dtick': 0.2,},
'yaxis':{'range': [0, 1], 'dtick': 0.2,},
'xaxis2':{'range': [0, 1], 'dtick': 0.2,},
'yaxis2':{'range': [0, 1], 'dtick': 0.2,},
'xaxis3':{'range': [0, 1], 'dtick': 0.2,},
'yaxis3':{'range': [0, 1], 'dtick': 0.2,},
'xaxis4':{'range': [0, 1], 'dtick': 0.2,},
'yaxis4':{'range': [0, 1], 'dtick': 0.2,},
'height':800,
'width':800,
'template':'plotly_white'
}
)
So my questions are:
- How do I update layout for each subplot programatically, instead of the brutal way of copying & pasting mannually? Something like a template layout for each subplot? The naming of
xaxis
,xaxis2
,xaxis3
feels especially suspicious to me. - Why do we specify subplot title
subplot_titles
as a list inmake_subplots
, instead oftitle
,title1
insidefig.update_layout
whenxaxis
,xaxis2
is part of the design language. - Coming from the matplotlib world, where each subplot is a standalone figure, which can be modified however one wants, I do wander if there is similar way to do this in Plotly. Thanks