Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Bug]: Text sometimes is missing when figure saved to EPS #21509

Closed
@uranix

Description

@uranix

Bug summary

I'm using cartopy to render data in polar projection. After an update I noticed that labels and title is not anymore rendered in saved eps file, though it was rendered in Jupyter notebook. I managed to simplify the code and found that matplotlib=3.3.4 does not suffer from the problem, while matplotlib=3.4.3 does.

The testing environment was obtained by calls

conda create -c conda-forge -n mpl-3.3.4 matplotlib=3.3.4 cartopy=0.18.0 python=3.7
conda create -c conda-forge -n mpl-3.4.3 matplotlib=3.4.3 cartopy=0.18.0 python=3.7

Might be related to #20364

Code for reproduction

#!/usr/bin/env python
# coding: utf-8

import matplotlib.pyplot as plt
import cartopy.crs as ccrs 
import matplotlib.ticker as mticker

def test(spacing, name):
    m = ccrs.NorthPolarStereo(central_longitude=0)
    plt.figure(figsize=(13, 13))
    plt.rc('font', size=16)
    ax = plt.axes(projection=m)
    plt.title('>>> do you see me <<<')
    ax.set_extent((-180, 180, 15, 90), crs=ccrs.PlateCarree())
    gl = ax.gridlines(draw_labels=False)
    gl.xlocator = mticker.FixedLocator(range(-180, 180, spacing))
    plt.savefig(name, bbox_inches='tight')
    
test(40, '/tmp/good.eps')
test(30, '/tmp/bad.eps')

Actual outcome

An eps file with no >>> do you see me <<< message. (matplotlib v3.4.3)

image

Expected outcome

An eps file with >>> do you see me <<< message. (matplotlib v3.3.4)

image

Operating system

Debian GNU/Linux bookworm, Linux Mint 20.2 Uma

Matplotlib Version

3.4.3

Matplotlib Backend

Qt5Agg

Python version

Python 3.7.12

Jupyter version

not used

Other libraries

cartopy=0.18.0

Installation

conda

Conda channel

conda-forge

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions