jupyter-lab - plotnine - jupyter lab - 在边距中添加 x 和 y 值
问题描述
我已导入 plotnine 并运行以下代码。
示例运行,但是当我运行如下图时,我会在边距中打印所有 x 和 y 值。其他人r
x = np.arange(-5.,5.,0.25,dtype=float)
gamma = 5.
y = gamma * x / (x ** 2 + gamma)
gg = pd.DataFrame()
gg['x'] = x
gg['y'] = y
p = ggplot(aes(x,y),gg) + geom_point()
p.save(filename = 'test3.png', height=5, width=5, units = 'cm')
p
解决方案
用 Roseanne Rosannadanna 的话来说——“没关系”。
除非其他人从 R ggplot 包转换。
我可能已经在 R 中写过 1000 个 ggplots,上面的问题是 R ggplot 语句采用上面的 x 和 y 变量:
p = ggplot(aes(x,y),gg) + geom_point()
显然 plotnine 需要分配 x 和 y ,所以这有效:
p = ggplot(aes(x='x',y='y'),gg) + geom_point().
推荐阅读
- php - WP 插件外部 API,自定义帖子类型
- json - Swift 4 JSON 解码
- java - Spring boot - 添加 JSTL 依赖会导致问题
- r - 根据测量日期与另一个数据集中的其他两个日期相比,标记一个数据集中的行
- javascript - 调用自身的阶乘函数
- javascript - RegExp,如何在 javascript 中连接字符串以创建动态正则表达式?
- python-3.x - 合并卫星图像并保留坐标
- vb.net - Exchange Web 服务邮件横幅
- python - 使用matplotlib python将单独的图绘制成一个图形
- mysql - MySql 识别每个组中的行。