Red Pencil
Red Pencil

Reputation: 121

IPython qtconsole inline ploting on black background does not work properly

I am using Python from Enthought Canopy.
After updating the library I ran into some problems. The first problem was, that I do not like black foreground on white background presettings, so I changed this via the IPython config by adding

c.IPythonWidget.syntax_style = 'monokai'

However this triggered a new problem, since now no longer the full plot is correctly displayed. I have attached two images to make this more clear:

Plot is ok, but I dislike the color styles for the console The frame size for the plot is somehow overriden by the black color background of the console

Before It looked like this: The setting for the true frame is around the title and axes numbering

I will appreciate your help since I have no clue about how to solve this. Somehow the border is no longer defined to be around the text and numbers from the axes.

Upvotes: 3

Views: 419

Answers (1)

Red Pencil
Red Pencil

Reputation: 121

Using my second monitor I realised that the ticklabels are at least barely visible. Therefore this has nothing to do with the change I did for the syntax highlighting and the console appearance. Then I had to look up how the plot are created in general.
It turns out, that the thing I have been looking for is called

'fig.patch.set_facecolor'

and by default the value for it was set to (1,1,1,0) instead of (1,1,1,1) for having a white facecolor patch. I did not found such a value in the matplotlibrc configuration file so I had to manually set this value in a file called "figure.py" located in the matplotlib folder.
The line which had to be changed is line number 327

    324 # the figurePatch name is deprecated
    325 self.patch = self.figurePatch = Rectangle(
    326     xy=(0, 0), width=1, height=1,
    327     facecolor='white', edgecolor=edgecolor,
    328     linewidth=linewidth)
    329 self._set_artist_props(self.patch)
    330 self.patch.set_aa(False)

from its original setting facecolor = facecolor to facecolor = 'white'.

I think this is not a good solution as this permanently sets the facecolor to white unless you change it by hand. Furthermore I found this link:

How to set opacity of background colour of graph wit Matplotlib

very helpful for the illustration of what patches are for.

Inline plotting on black background :)

Upvotes: 2

Related Questions