figsize wrong in Qt5Agg import

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
DJP
Reply | Threaded
Open this post in threaded view
|

figsize wrong in Qt5Agg import

DJP
Using the qt5agg backend, I get plots that are 2 times too small unless I use pyplot.

I just upgraded to matplotlib 2.01.  I'm running on a Mac using the Anaconda installation: 4.3.17                   py36_0 

This two scripts produce plots that are the same size.  Why do I have to double the figsize parameters when I do not use pyplot?  Seems like a bug.  I didn't need to do this for the Qt4Agg backend.

# script 1
import matplotlib
matplotlib.use('Qt5Agg')
import matplotlib.pyplot as plt
fig1, ax = plt.subplots(figsize=(6, 4))
ax.plot([1, 2, 3, 2, 3, 4, 3, 4, 5])
ax.set_title('A simple plot')
ax.grid(True)
ax.set_xlabel('time')
ax.set_ylabel('volts')
plt.savefig('test1.pdf')
plt.show()

# script 2
import matplotlib
matplotlib.use('Qt5Agg')
from matplotlib.backends.backend_qt5agg \
     import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure
fig = Figure(figsize=(12, 8))
canvas = FigureCanvas(fig)
ax = fig.add_subplot(111)
ax.plot([1, 2, 3, 2, 3, 4, 3, 4, 5])
ax.set_title('A simple plot')
ax.grid(True)
ax.set_xlabel('time')
ax.set_ylabel('volts')
canvas.print_figure('test2.pdf')
canvas.show()


_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|

Re: figsize wrong in Qt5Agg import

tcaswell
David,

Was this fixed in 2.0.2 ?

On Sat, Aug 5, 2017 at 12:35 PM David J Pine <[hidden email]> wrote:
Using the qt5agg backend, I get plots that are 2 times too small unless I use pyplot.

I just upgraded to matplotlib 2.01.  I'm running on a Mac using the Anaconda installation: 4.3.17                   py36_0 

This two scripts produce plots that are the same size.  Why do I have to double the figsize parameters when I do not use pyplot?  Seems like a bug.  I didn't need to do this for the Qt4Agg backend.

# script 1
import matplotlib
matplotlib.use('Qt5Agg')
import matplotlib.pyplot as plt
fig1, ax = plt.subplots(figsize=(6, 4))
ax.plot([1, 2, 3, 2, 3, 4, 3, 4, 5])
ax.set_title('A simple plot')
ax.grid(True)
ax.set_xlabel('time')
ax.set_ylabel('volts')
plt.savefig('test1.pdf')
plt.show()

# script 2
import matplotlib
matplotlib.use('Qt5Agg')
from matplotlib.backends.backend_qt5agg \
     import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure
fig = Figure(figsize=(12, 8))
canvas = FigureCanvas(fig)
ax = fig.add_subplot(111)
ax.plot([1, 2, 3, 2, 3, 4, 3, 4, 5])
ax.set_title('A simple plot')
ax.grid(True)
ax.set_xlabel('time')
ax.set_ylabel('volts')
canvas.print_figure('test2.pdf')
canvas.show()

_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users

_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users