-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Closed
Milestone
Description
It appears that when there is a path outside the plotting limits then not all the path coordinates get plotted. When I run the code below with xmax=1.1
versus xmax=1.0
, the axvspan is plotted wrong in latex. Inspection of the pgf file for the two versions of xmax
indicates that a \pgfpathlineto
command is missing in the xmax=1.1
version. I've traced it to _print_pgf_path()
in the backend and the line for points, code in path.iter_segments(transform, clip=clip):
which is asking for clipped points.
Python Code
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot([0,1],[0,1],'-k')
ax.set_xlim(0,1)
ax.axvspan(xmin=0.5, xmax=1.1)
fig.savefig('test.pgf')
Latex code
\documentclass {article}
\usepackage{pgf}
\begin{document}
\begin{figure}
\centering
\input{test.pgf}
\end{figure}
\end{document
Here is a pic of the result after compiled with latex (pdflatex or xelatex)
However, saving to .pdf produces the right result