python - 在 Sympy.mpmath.plot 中更改图形大小

标签 python matplotlib plot sympy mpmath

我希望这个问题不是太初级。我已广泛搜索解决方案,但尚未找到解决方案。

我最近开始使用 Jupyter Notebook 和 Sympy 在我的微积分 II 课上做笔记和做作业(这是一个多么巨大的好处!)。

但是,我唯一的问题是我无法弄清楚如何配置绘图的大小(即以像素为单位的尺寸)。

直接使用 matplotlib 很容易(特别是 matplotlib.pyplot.figure()),但我使用的是 Sympy.mpmath.plot module 因为 Sympy 对于我们在本类(class)中进行的符号操作来说效果更好。我知道 Sympy 有自己的绘图模块,但 mpmath 中的那个似乎更容易使用(当然,除了这个问题)。

但是,我查看了 mpmath 文档并反复用 google 搜索了这个问题,但没有找到解决方案。

如何更改使用 mpmath API 绘制函数所产生的图像大小?

最佳答案

您可以尝试在 pyplot rcParams 中更改 sympy 绘图的大小:

import sympy
import matplotlib.pyplot as plt
%matplotlib inline

plt.rcParams['figure.figsize'] = 10, 3
sympy.mpmath.plot([cos, sin], [-4, 4])

enter image description here

关于python - 在 Sympy.mpmath.plot 中更改图形大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33174301/

相关文章:

python - pytorch中自定义数据集的数据预处理(transform.Normalize)

python - 正确,Matplotlib 中的 "full length"左右箭头?

matplotlib - savefig 错误

javascript - 如何在使用 highcharter 制作的箱线图中添加平均线?

r - 在 R 中绘制 Kohonen map 时出错?

python - 按多列排名并按另一列分组

python - 具有 unicode 字符的 SPARQL 正则表达式过滤器

python - 为动态方程输入组织和构建 numpy 数组

python - add_axes 和 add_subplot 有什么区别?

python - python环境中不规则网格上的曲面图