Skip to content

pgf title is not centered properly #9747

Closed as not planned
Closed as not planned
@asmeurer

Description

@asmeurer

I tested this with the matplotlib master

import numpy as np
import matplotlib.pyplot as plt
plt.figure()
x = np.linspace(0.0, 1.0, 101)
y = x ** 2
plt.plot(x, y)
plt.title('sympy.lambdify\nwith UMFPACK')
plt.savefig('test.pgf')

Then compile this with a test.tex

\documentclass{article}

\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8x]{inputenc}
\usepackage[scaled=0.8]{DejaVuSansMono}
\bibliographystyle{plain}

% \usepackage[all]{xy}
\usepackage{amsmath}

% for images: png, pdf, etc
\usepackage{graphicx}

% for matplotlib pgf output
\usepackage{pgfplots}

\begin{document}
\begin{figure}[!ht]
\centering
\resizebox{0.9\textwidth}{!}{\input{test.pgf}}
\label{fig:test}
\end{figure}

\end{document}
pdflatex test.tex

The resulting image looks like

screen shot 2017-11-10 at 6 47 47 pm

If you save as another format, like png, it is centered properly:

test

I can't reproduce it with all titles, so I'm not sure what exactly is going on with my specific title string.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Difficulty: Hardhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issuesbackend: pgfstatus: closed as inactiveIssues closed by the "Stale" Github Action. Please comment on any you think should still be open.status: inactiveMarked by the “Stale” Github Actiontopic: text

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions