I want a simple way to plot multiple figures onto subplots.
Below is my code , but there is a problem that right colorbar on each figure can not put in right position, they are overlaped. You know each heatmap contain different values .
Create each trace manually, and set to subplot is very time consuming , thatโs why I want to reuse the figure , directly draw on subplots. So what should I do to the corlorbar ?
import plotly.graph_objects as go
from plotly.subplots import make_subplots
cols = ['total_trades', 'max_dd', 'win_rate', 'total_return', 'sharpe_ratio', 'calmar_ratio', ]
cn=3
rn=int(np.ceil(len(cols)/cn))
pad_titles = cols + (cn*rn - len(cols)) * ['']
fig = make_subplots(rows=rn, cols=cn, subplot_titles=pad_titles)
for i, c in enumerate(cols):
f = s[c].vbt.heatmap()
# print(i//cn+1,i%cn+1)
for trace in f.data:
fig.add_trace(trace, row=i//cn+1, col=i%cn+1)
fig.update_layout(
height=rn* 600,
)
fig.show()