How to set the inline image opaque in QtConsole3?

79 views Asked by At

I run QtConsole3 with thw following command:

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

And plot a figure with following lines:

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)

However, the axis and the labels in the figure are disappeared because the inline figure is transparent and the background is black. enter image description here

So how to run QtConsole with some extra arguments such that the inline figure would display proper?

1

There are 1 answers

0
mdurant On

You could change your rcparams programatically before plotting

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

or in your matplotlibrc file; or you could be explicit:

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