[Matplotlib-users] figsize wrong in Qt5Agg import

Thomas Caswell tcaswell at gmail.com
Sat Aug 5 19:54:37 EDT 2017


David,

Was this fixed in 2.0.2 ?

On Sat, Aug 5, 2017 at 12:35 PM David J Pine <djpine at gmail.com> 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
> Matplotlib-users at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20170805/267ab0ee/attachment.html>


More information about the Matplotlib-users mailing list