X Tutup
Skip to content

Coordinates of text not properly set in pgf files #8067

@ghost

Description

Bug summary
The coordinates of text (legends, titles) are not properly set in pgf files.

Code for reproduction
Producing the pgf figure with a slightly altered pylab_examples "tex_demo.py":

import numpy as np
import matplotlib.pyplot as plt

plt.rc('text', usetex=True)
plt.rc('font', family='serif')
plt.figure(1, figsize=(6, 4))
ax = plt.axes([0.1, 0.1, 0.8, 0.7])
t = np.linspace(0.0, 1.0, 100)
s = np.cos(4 * np.pi * t) + 2
plt.plot(t, s)
plt.xlabel(r'\textbf{time (s)}')
plt.ylabel(r'\textit{voltage (mV)}', fontsize=16)
plt.title(r"\TeX\ is Number $\displaystyle\sum_{n=1}^\infty"
          r"\frac{-e^{i\pi}}{2^n}$!", fontsize=16, color='r')
plt.grid(True)
plt.savefig('tex_demo.pgf')    # altered line
plt.show()

Taking this pgf file ("tex_demo.pgf") in my latex file:

\documentclass{article}
\usepackage{pgf}
\begin{document}
\input{tex_demo.pgf}
\end{document}

Actual outcome
This gives the output "Bugreport.pdf".
Bugreport.pdf

Expected outcome
The graphic should look like in the example:
http://matplotlib.org/examples/pylab_examples/tex_demo.html

Matplotlib version

  • Matplotlib 1.5.2rc2, Python 3.5.2 and Fedora 25 (Workstation Edition)
  • All components were installed via the Fedora specific system tools (dnf) from Fedora repositories

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup