How to align subplots (in a plot grid) for some specified values with a simple plot in Matplotlib?

Signals are recorded for many temperatures and at some temperatures (that are evenly spaced), more complex experiments are performed with another varying parameter.

This is a simple simulated example.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>def my_temp_func(temp):
return -0.05*(temp-350.0)**2+2500
all_temp=np.linspace(150.0, 550.0, 100)
some_temp=np.linspace(200.0, 500.0, 4)
fig, axs = plt.subplots(figsize=(9,3))
axs.plot(all_temp,my_temp_func(all_temp),marker='None')
axs.plot(some_temp,my_temp_func(some_temp),marker='o',linestyle='None');
</code>
<code>def my_temp_func(temp): return -0.05*(temp-350.0)**2+2500 all_temp=np.linspace(150.0, 550.0, 100) some_temp=np.linspace(200.0, 500.0, 4) fig, axs = plt.subplots(figsize=(9,3)) axs.plot(all_temp,my_temp_func(all_temp),marker='None') axs.plot(some_temp,my_temp_func(some_temp),marker='o',linestyle='None'); </code>
def my_temp_func(temp):
    return -0.05*(temp-350.0)**2+2500

all_temp=np.linspace(150.0, 550.0, 100)
some_temp=np.linspace(200.0, 500.0, 4)

fig, axs = plt.subplots(figsize=(9,3))
axs.plot(all_temp,my_temp_func(all_temp),marker='None')
axs.plot(some_temp,my_temp_func(some_temp),marker='o',linestyle='None');

enter image description here

On this figure, a signal is recorded between 150K and 550K. And at some temperature values (orange mark), more complex experiments are performed and they are plotted on a grid.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>def my_response_func(temp,I0,time):
inf_resp=my_temp_func(temp)
return inf_resp*(I0*np.exp(-0.005*time)+1)
all_time=np.linspace(0, 1000, 1000)
some_exc=np.linspace(1, 1.5, 3)
fig, axs = plt.subplots(len(some_exc), len(some_temp), figsize=(9,6), sharex=True, sharey=True)
plt.subplots_adjust(wspace=0, hspace=0)
for i,i_temp in enumerate(some_temp):
for j,j_exc in enumerate(some_exc):
axs[j][i].plot(all_time,my_response_func(i_temp,j_exc,all_time),marker='None')
axs[j][i].tick_params(labelbottom = False)
for ax, label in zip(axs[:,0], some_exc):
ax.set_ylabel("Exc:"+str(label), rotation=90, size='x-large', labelpad=10)
for ax, label in zip(axs[-1,:], some_temp):
ax.set_xlabel(str(label)+"K", rotation=0, size='x-large', labelpad=10)
</code>
<code>def my_response_func(temp,I0,time): inf_resp=my_temp_func(temp) return inf_resp*(I0*np.exp(-0.005*time)+1) all_time=np.linspace(0, 1000, 1000) some_exc=np.linspace(1, 1.5, 3) fig, axs = plt.subplots(len(some_exc), len(some_temp), figsize=(9,6), sharex=True, sharey=True) plt.subplots_adjust(wspace=0, hspace=0) for i,i_temp in enumerate(some_temp): for j,j_exc in enumerate(some_exc): axs[j][i].plot(all_time,my_response_func(i_temp,j_exc,all_time),marker='None') axs[j][i].tick_params(labelbottom = False) for ax, label in zip(axs[:,0], some_exc): ax.set_ylabel("Exc:"+str(label), rotation=90, size='x-large', labelpad=10) for ax, label in zip(axs[-1,:], some_temp): ax.set_xlabel(str(label)+"K", rotation=0, size='x-large', labelpad=10) </code>
def my_response_func(temp,I0,time):
    inf_resp=my_temp_func(temp)
    return inf_resp*(I0*np.exp(-0.005*time)+1)
all_time=np.linspace(0, 1000, 1000)
some_exc=np.linspace(1, 1.5, 3)

fig, axs = plt.subplots(len(some_exc), len(some_temp), figsize=(9,6), sharex=True, sharey=True)
plt.subplots_adjust(wspace=0, hspace=0)

for i,i_temp in enumerate(some_temp):
    for j,j_exc in enumerate(some_exc):
        axs[j][i].plot(all_time,my_response_func(i_temp,j_exc,all_time),marker='None')
        axs[j][i].tick_params(labelbottom = False)

for ax, label in zip(axs[:,0], some_exc):
    ax.set_ylabel("Exc:"+str(label), rotation=90, size='x-large', labelpad=10)
for ax, label in zip(axs[-1,:], some_temp):
    ax.set_xlabel(str(label)+"K", rotation=0, size='x-large', labelpad=10)   

This is the resulting figure :
enter image description here

I would like to have the two figures on the same one with the orange point align with the corresponding columns in the grid of the second plot. Actually, I do it by hand but I wondered if it is possible to automatize it ? (nb : the orange points are evenly spaced.)

For example, something like that :

enter image description here

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật