Skip to content

savefig with eps draws a hidden axis #10163

Closed
@nedlrichards

Description

@nedlrichards

Saving as eps file shows a hidden axis that does not appear in png file

I created a hidden axis in order to create a common y-axis label across 3 subplots. This works fine in the python figure window, and when I save the figure as a png. However, the hidden axis appears when the figure is saved as eps.

Code for reproduction

import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec

gs = gridspec.GridSpec(3,3)
gs.update(left=0.13, hspace=0.20)
fig = plt.figure()
axes = [plt.subplot(gs[0, :]), plt.subplot(gs[1, :]), plt.subplot(gs[2, :])]

fig.add_subplot(111, frameon=False)
plt.tick_params(labelcolor='none', top='off', bottom='off', left='off', right='off')

axes[0].set_ylim(-1.5, 1.5)
axes[1].set_ylim(-1.5, 1.5)
axes[2].set_ylim(-1.5, 1.5)
axes[0].set_xticklabels('')
axes[1].set_xticklabels('')

plt.ylabel('Large label')

plt.savefig('test.eps', format='eps')
plt.savefig('test')

Actual outcome
The png figure has 3 panels, with y tick labels from -1 to 1. The x axis has labels from 0 to 1. The eps file has the same tick labels as the png file, but a second set of tick labels are superimposed, running from 0 to 1 on both the x and y directions.

Matplotlib version

  • Operating system: OSX and RHEL
  • Matplotlib version: 2.0.2
  • Matplotlib backend (print(matplotlib.get_backend())): MacOSX
  • Python version: Python 3.6.2 |Intel Corporation

Intel python, and pip installs (or conda when possible).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions