1
我的熊貓DataFrame
results_print具有2-dim陣列,它們是圖像。我打印出來,像這樣:如何將python的ggplot對象添加到matplot網格?
n_rows = results_print.shape[0]
n_cols = results_print.shape[1]
f, a = plt.subplots(n_cols, n_rows, figsize=(n_rows, n_cols))
methods = ['img', 'sm', 'rbd', 'ft', 'mbd', 'binary_sal', 'sal']
for r in range(n_rows):
for c, cn in zip(range(len(methods)), methods):
a[c][r].imshow(results_print.at[r,cn], cmap='gray')
現在,我創建了一個蟒蛇ggplot圖像對象:
gg = ggplot(aes(x='pixels'), data=DataFrame({'pixels': results_print.at[6,'mbd'].flatten()})) + \
geom_density(position='identity', stat='density') + \
xlab('pixels') + \
ylab('') + \
ggtitle('Density of pixels') + \
scale_y_log()
我如何可以添加gg
爲元素,以我的matplotlib電網?