Я хочу иметь фигуру, состоящую, скажем, из четырех подзаговоров. Два из них - обычные линии, два из них imshow-images.
Я могу форматировать imshow-изображения на собственные сюжеты, потому что каждому из них нужна собственная панель цвета, модифицированная ось и другая ось удалены. Это, однако, кажется совершенно бесполезным для подзадачи. Может ли кто-нибудь помочь мне с этим?
Я использую это для отображения данных "обычных" графиков выше в виде цветовой схемы (путем масштабирования входного массива i
до [ i, i, i, i, i, i ]
для 2D и вызова imshow()
с ним).
Следующий код сначала отображает то, что мне нужно в качестве подзаголовка, а второе показывает все, что я могу сделать, чего недостаточно.
#!/usr/bin/env python
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
s = { 't':1, 'x':[1,2,3,4,5,6,7,8], 'D':[0.3,0.5,0.2,0.3,0.5,0.5,0.3,0.4] }
width = 40
# how I do it in just one plot
tot = []
for i in range(width):
tot.append(s['D'])
plt.imshow(tot, norm=LogNorm(vmin=0.001, vmax=1))
plt.colorbar()
plt.axes().axes.get_xaxis().set_visible(False)
plt.yticks([0, 2, 4, 6], [s['x'][0], s['x'][2], s['x'][4], s['x'][6]])
plt.show()
f = plt.figure(figsize=(20,20))
plt.subplot(211)
plt.plot(s['x'], s['D'])
plt.ylim([0, 1])
#colorplot
sp = f.add_subplot(212)
#reshape (just necessary to see something)
tot = []
for i in range(width):
tot.append(s['D'])
sp.imshow(tot, norm=LogNorm(vmin=0.001, vmax=1))
#what I can't do now but needs to be done:
#sp.colorbar()
#sp.axes().axes.get_xaxis().set_visible(False)
#sp.yticks([0, 200, 400, 600, 800, 1000], [s['x'][0], s['x'][200], s['x'][400], s['x'][600], s['x'][800], s['x'][1000]])
plt.show()