<h3>更新</h3>
<p>根据前面的回答,您可以<code>make_subplots()</code>、<code>add_trace()</code>和最后<code>update_layout()</code></p>
<p>来自GitHub的<em>源</em></p>
<pre><code>import requests
import io
rscu1 = pd.read_csv(io.StringIO(requests.get("https://raw.githubusercontent.com/dongzhang0725/sample_data/main/JQ038231.1_RSCU_stack.csv").text))
rscu2 = pd.read_csv(io.StringIO(requests.get("https://raw.githubusercontent.com/dongzhang0725/sample_data/main/MG970255.1_RSCU_stack.csv").text))
</code></pre>
<h3>溶液</h3>
<pre><code># want "bottom" figure to use it's own axis to add to subplots
fig_bottom.data[0]["xaxis"]="x3"
fig_bottom.data[0]["yaxis"]="y3"
# subplots figure...
figall = make_subplots(rows=3, row_heights=[.4,.4,.2])
# add all the traces to appropriate subplot
for f in fig.data:
if f["yaxis"] == "y":
figall.add_trace(f, row=1, col=1)
else:
figall.add_trace(f, row=2, col=1)
figall.add_trace(fig_bottom.data[0], row=3, col=1)
# copy / modify layout of subplots figure
figall.update_layout(fig.layout)
fh = .38 # height of first two charts
figall.update_layout(
yaxis={"domain":[(1-2*fh)-.03,(1-fh)-.03]},
yaxis2={"domain":[1-fh,1]},
xaxis3={"title": None, "showticklabels": False},
yaxis3={"title": None, "showticklabels": False},
height=fig.layout["height"] + fig_bottom.layout["height"],
)
figall.update_traces(marker_coloraxis=None)
# recenter annotations....
for i, a in enumerate(figall.layout["annotations"]):
a["y"] = (1-i*(fh+.03))-fh/2
figall
</code></pre>
<p><a href="https://i.stack.imgur.com/0lRAl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0lRAl.png" alt="enter image description here"/></a></p>