【问题标题】:How to set the inline image opaque in QtConsole3?如何在 QtConsole3 中设置内联图像不透明?
【发布时间】:2015-08-30 15:24:51
【问题描述】:

我使用以下命令运行QtConsole3:

ipython3 qtconsole --cache-size=4000 --matplotlib=inline --colors=Linux

并用以下几行绘制一个图形:

In [1]: import numpy as np

In [2]: import matplotlib.pyplot as plt

In [3]: x = np.linspace(-1, 1, 1024) * 4 * np.pi

In [4]: y = np.sin(x) / x

In [5]: plt.plot(x, y)

但是图中的轴和标签都消失了,因为内联图是透明的,背景是黑色的。

那么如何使用一些额外的参数运行QtConsole 以使内联图形正确显示?

【问题讨论】:

  • 你有什么理由不只使用 LightBG 颜色而不是 Linux?
  • @PeterBrittain 我只是想试试^_^

标签: python python-3.4 qtconsole


【解决方案1】:

您可以在绘图之前以编程方式更改 rcparams

matplotlib.rcParams['figure.facecolor'] = "(1, 1, 1)"

或在您的 matplotlibrc 文件中;或者你可以是明确的:

fig = figure(facecolor='w')
ax = fig.add_subplot(111)
ax.plot(x, y)
fig

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-06-16
    • 2014-09-05
    • 2020-05-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-12
    • 1970-01-01
    相关资源
    最近更新 更多