【问题标题】:Alternative to imagesc and angle of matlab in pythonpython中matlab的imagesc和角度的替代方案
【发布时间】:2018-12-15 15:13:47
【问题描述】:

我有这段代码可以在 matlab 中绘制图像。这段代码在 python 中如何使用 matplotlib pyplot?我没有得到相同的情节使用它。我的 matplotlib 使用 numpy.angle 提供了一个全黑白图像。

f1 = figure(66); imagesc(-angle(O),[-.6,1]); axis image; colormap gray; axis off

Obs:变量 O 是一个复数数组。 谢谢各位。

【问题讨论】:

  • 您希望如何将复数映射到颜色?
  • 这就是为什么我要在显示颜色之前获得它的相位角。这段代码在 Matlab 上很完美,我只是在努力翻译它
  • numpy.angle 应该给你一个角度。您可以提供minimal reproducible example 以查看问题所在。

标签: python matlab numpy matplotlib


【解决方案1】:

它变成黑白的原因是因为您绘制的值超出了 -0.6 到 1 的范围。

numpy.angle 可能以度为单位返回,或者相位角只是由于某种原因而不同 - 例如,异相 180 度。

【讨论】:

    猜你喜欢
    • 2021-10-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-20
    • 1970-01-01
    • 2021-04-13
    相关资源
    最近更新 更多