python - 使用 tikzplotlib 保存箭袋图
问题描述
我想使用 tikzplotlib 保存一个箭袋图。这是一个MWE:
import matplotlib.pyplot as plt
import numpy as np
x,y = np.meshgrid(np.arange(-2, 2, .2), np.arange(-2, 2, .25))
z = x*np.exp(-x**2 - y**2)
v, u = np.gradient(z, .2, .2)
fig, ax = plt.subplots()
q = ax.quiver(x,y,u,v)
import tikzplotlib
tikzplotlib.save("2delete.tex")
我收到这样的错误:
File "/usr/local/lib/python3.6/dist-packages/tikzplotlib/_patch.py", line 69, in <genexpr>
yield tuple(seq[i % len(seq)] for seq in seqs)
ZeroDivisionError: integer division or modulo by zero
有人知道这个问题和解决方法吗?谢谢!
解决方案
来自 GitHub存储库:
Of course, not all figures produced by matplotlib can be converted without error
您可以加载保存的图像,而不是将绘图直接加载到 tex 中。
推荐阅读
- ios - UItableview 单元格内的GrowingTextView 或可扩展文本视图
- android - 完成活动时的Android android.permission.INTERACT_ACROSS_USERS警告
- javascript - 使用 es6 使用动态键连接 setState
- javascript - c3.js如何将y标签放置在水平条形图中的条内?
- css - 为什么在调整窗口大小时输入字段的左侧没有空间?
- python - 在 PyQt 的文件夹中显示文件
- laravel - Laravel 一对多关系,完整性约束违反错误
- java - 运行 Spring Boot 集成测试时加载 ApplicationContext 失败
- java - 向已经声明的类添加接口?
- ansible - ansible循环中的Jinja模板