【问题标题】:Understanding concept of %matplotlib inline and import chart理解 %matplotlib 内联和导入图表的概念
【发布时间】:2017-10-31 19:18:45
【问题描述】:

我从谷歌得到一段代码并试图理解它,这很有帮助 此刻对我来说。

   %matplotlib inline
   from math import sin, pi
   import random
   import chart
   from matplotlib import rcParams
   rcParams.update({'font.size': 12})

GPS 载体

  f = 154 * 10.23e6
  carrier = lambda x: sin(2*pi*f*x)
  chart.Plot('GPS L1 Carrier Wave', tend=8/f, sr=1.0e-12).
  signal(carrier,    color=chart.blue).show()

当我运行相同的代码时,出现错误,显示没有名为 chart 的模块。 想知道什么是matplotlib inline 和chart 函数。 在执行代码时,它会抛出错误 no module named chart。 甚至找不到任何模块名称图表

提前致谢。

【问题讨论】:

  • %matplotlib inline 旨在用于 jupyter(笔记本或控制台)。如果您不使用它们中的任何一个,请将其排除在外,否则它只会告诉 jupyter 内联显示输出。关于chart,您可能还没有安装软件包。

标签: python-2.7 matplotlib


【解决方案1】:

您使用的是 Jupyter Notebook 还是 Jupyter QtConsole?因为 %matplotlib inline 仅适用于 Jupyter Notebook 和 Jupyter QtConsole。 您可以参考Jupyter & IPython: What does %matplotlib inline do?了解更多信息。

【讨论】:

  • 哦,我正在使用 spyder 。蟒蛇 2.7 。我不能在 spyder 中运行它吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2022-01-22
  • 1970-01-01
  • 1970-01-01
  • 2020-06-25
  • 1970-01-01
  • 2014-09-13
  • 1970-01-01
相关资源
最近更新 更多