Speed up the processing time a duplicated plot

Summary

So I have a plot displaying a time series data. I want to create a duplicated zoomed-in version of it, which I used as following:

f_zoomed = go.Figure(f_initial, layout_xaxis_range [scp_df_zoom.value_timestamp.min(),scp_df_zoom.value_timestamp.max()])

st.plotly_chart(f_zoomed)

This took much longer to process since it has to plot twice. Is there a way to optimize this process?
Thanks!

Hi @Khoa_Dang

Thatโ€™s a great question where if I was to tackle would require experimentation by comparing the various ways in rendering the plot and seeing which approach gives the best performance.

For instance, you could compare the rendering of the zoomed-in and zoomed-out versions as 2 distinct figures then comparing that with the version where there is a single figure with 2 sub-plots. Here, you can use streamlit-profiler to benchmark and compare these 2 approaches. More info here:

Hope this helps!