【发布时间】:2017-03-20 19:04:50
【问题描述】:
我的 pandas DataFrame results_print 有 2-dim 数组是图像。我像这样打印它们:
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')
现在我创建了一个 python 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 网格中?
【问题讨论】:
标签: python matplotlib python-ggplot