matplotlib / matplotlib/matplotlib
Support partial usetex in ps output
Personne n'a encore pris cette issue.
- Langage dominant
- Python
- Étoiles
- 23.2k
- Forks
- 8.5k
- Merge moyen
- 1 j 6 h
- PR mergées (30 j)
- 66
Description
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:
```python
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](https://github.com/matplotlib/matplotlib/blob/ab98852fa3b760e87208de53d058f82c3bf934bc/lib/matplotlib/backends/backend_ps.py#L191) 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.
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par lib/matplotlib/backends/backend_ps.py et la gestion de textcnt par RendererPS, puis exécutez l’exemple Python minimal de l’issue qui enregistre une figure sous le nom test.ps. Confirmez le comportement des objets texte utilisant usetex=True alors que le paramètre global est false ; c’est terminé lorsque les sorties PS et EPS s’enregistrent sans l’AttributeError signalé.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- latex, matplotlib, python
- Domaine
- backend, data-visualization
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Clairement spécifiée
- Accessibilité débutants
- 45/100