Skip to content

[Bug]: Blank output EPS file when using latex and figure.autolayout = True #22840

Closed

Description

@robintimmis

Bug summary

When figure.autolayout is set to True the output in the EPS file becomes blank. The file is produced and no errors are mentioned.

Code for reproduction

import matplotlib.pyplot as plt

plt.rc('text', usetex=True)
plt.rcParams["figure.figsize"] = [3.4, 2.47]
plt.rcParams['figure.autolayout'] = True

[Ignoring creation of data for plots]

plt.plot(t,d,label='electron bunch energy density')
plt.savefig('test.eps')

Actual outcome

EPS file converted to PDF

test.pdf

Expected outcome

EPS file converted to PDF with plt.rcParams['figure.autolayout'] = False and all else the same

test_false.pdf

Additional information

The bug appears when I change to autolayout = True. I noticed there was an earlier bug fix for a very similar scenario (#16898) which seems to fix for the case where figure.autolayout = False.

Operating system

HPE Cray Linux Environment

Matplotlib Version

3.5.1

Matplotlib Backend

module://matplotlib_inline.backend_inline

Python version

3.8.5

Jupyter version

3.2.9

Installation

pip

Activity

  1. jklymak commented on Apr 13, 2022

    @jklymak
    Member

    Not sure what is going on. But you can manually set tight_layout or constrained_layout

  2. robintimmis commented on Apr 13, 2022

    @robintimmis
    Author

    That does appear to work, you are right, thankyou. But I need to set it in the rc params since I am using another program to plot other graphs in matplotlib and cannot access these figures to manually change this.

  3. tacaswell commented on Apr 13, 2022

    @tacaswell
    Member

    I think this is a duplicate of #21930 which was fixed by #22732

    @robintimmis If you are able to install from source, checking if this works for you on either main or v3.5.x would be very helpful!

  4. added this to the v3.5.2 milestone on Apr 13, 2022
  5. tacaswell commented on Apr 13, 2022

    @tacaswell
    Member

    I'm going to close this as a duplicate, please ping to have re-open if this is in fact not fixed on the development versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions