问题描述
我想使用 datashader 输出作为 plt 子图的输入。
我正在尝试运行此问题的答案中建议的代码: Add datashader image to matplotlib subplots
代码如下:
from datashader.mpl_ext import DSArtist
import datashader as ds
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
import pandas as pd
import numpy as np
N = 10000
df = pd.DataFrame(np.random.random((N,3)),columns = ['x','y','z'])
f,ax = plt.subplots(2,2)
ax_r = ax.ravel()
da = DSArtist(ax_r[0],df,'x',ds.mean('z'),norm = mcolors.LogNorm())
ax_r[0].add_artist(da)
ax_r[1].hist(df['x'])
ax_r[2].hist(df['y'])
ax_r[3].plot(df['z'])
plt.tight_layout()
plt.show()
我收到一个错误:
---> da = DSArtist(ax_r[0],norm = mcolors.LogNorm())
TypeError: __init__() missing 7 required positional arguments: 'shade_hook','plot_width','plot_height','x_range','y_range','width_scale',and 'height_scale'
我尝试在此处查看 DSArtist 的源代码 (https://github.com/holoviz/datashader/pull/200/files),但并没有完全遵循。
如何解决错误?
谢谢!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)