How to get good plots in Spyder python ? (Inline and Qt5)

Question:

When i plot in Spyder with the Backend Qt5 in graphics ( the window that pops with the plot) i don’t get things aesthetically beautiful. The title sometimes is not showing, the labels, … All in all it is just not good looking. But when it is plotted "inline" it is very well presented.

What I want is :
I want the plot with the Backend Qt5 option very well presented like the Backend Inline option.

The code is this :

    import numpy as np
    from matplotlib import pyplot as plt
    plt.plot(np.linspace(0,2, num = 5))
    plt.title('Blabla')
    plt.xlabel('Anything')
    plt.ylabel('Everything')

What I get with the Backend Qt5 option
What I get with the Backend Inline option

Asked By: Mehdi Zakaria

||

Answers:

I think the command %matplotlib qt might be the solution to this problem. You should write the line in the IPython Console.

Answered By: user20167936

The problem was the use of this line in order to increase the quality of the plots:

plt.rcParams['figure.dpi'] = 300

In Qt5 it’s not required.

Answered By: Mehdi Zakaria
Categories: questions Tags: , , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.