Skip to content

Support partial usetex in ps output #7741

Open
@pfigliozzi

Description

@pfigliozzi

I am trying to save some figures I made as .ps or .eps but I am getting an error. I narrowed the error down to the fact that I am using Latex for some of the text in my figure but using rc.params['text.usetex'] = False. Here is some code that reproduces the bug:

import matplotlib
import matplotlib.pyplot as plt
fig = plt.figure()
plt.text(0.5, 0.5, 'Here is some text, $math mode$', ha='center', va='center', usetex=True)
fig.savefig('test.ps')

The error you get is AttributeError: 'RendererPS' object has no attribute 'textcnt'

When looking at this code in in the RendererPS class the textcnt attribute is only added when rc.params['text.usetex'] = True. However I am just using Latex for specific text objects with the option usetex=True. Is there a way to save these figures as .ps or .eps?

I am using Matplotlib 1.5.1 installed via conda on Windows with python 2.7. I also tested it with Matplotlib 2.0.0b4 which also produced the same error, however I would prefer a solution for 1.5.1 if possible.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions