我在 Mac 上使用 Texpad。我使用 pgfplots 制作了一个包含 3 个图的图形。几天前它还能用,但今天我打开文件时,它无法生成 pdf。编译过程中没有显示任何错误。有人知道原因是什么吗?
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[sc]{mathpazo}
\usepackage{amsmath,amssymb,amsfonts,mathrsfs}
\usepackage[amsmath,thmmarks]{ntheorem}
\usepackage{graphicx}
\usepackage{multirow}
\usepackage{geometry}
\usepackage{booktabs,makecell,longtable}
\usepackage{lipsum}
\usepackage{pdfpages}
\usepackage{balance}
\usepackage{lastpage}
\usepackage{amsmath,bm}
\usepackage{textcomp}
\usepackage{subeqnarray}
\usepackage{float}
\usepackage{mathtools}
\usepackage{cite}
\usepackage[export]{adjustbox}
\usepackage{etoolbox}
\usepackage{enumitem}
\usepackage{lmodern}
\usepackage[labelfont=bf,font=sf,labelsep=space]{caption}
\usepackage{mathpazo}
\usepackage[nottoc,notlot,notlof]{tocbibind}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\usepackage{hyperref}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\pgfkeys{/pgf/number format/.cd,1000 sep={}}
\newcommand{\myfont}{\fontfamily{cmss}\selectfont}% used with mathpazo
\DeclareMathOperator{\Tr}{Tr}
\setcounter{tocdepth}{2}
\pgfplotsset{compat=1.5.1}
\pgfplotsset{label style={font=\Large},
tick label style={font=\Large}}
\pgfplotsset{error bars/.cd,
x dir=both, x explicit,
y dir=both, y explicit,
}
\pgfplotsset{/pgfplots/error bars/error bar style={semithick,black}}
%\pgfplotsset{/pgfplots/label shift={0pt}}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[trim axis left]
\begin{axis}[
xmode=log,
ymode=normal,
enable tick line clipping=false,
axis line style=semithick,
width=9cm,
height=7cm,
legend image post style={mark options={scale=1}},
legend style={at={(0.95,10.9)},draw=none,
legend style={row sep=1pt},
legend style={column sep=3pt}},
legend cell align={left},
x tick style={black,semithick},
xmin=0.05,xmax=2000,
xtick={0.1,1,10,100,1000},
xtick pos=bottom,
minor x tick num=9,
xtick align=outside,
y tick style={black,semithick},
y label style=
{at={(ticklabel cs:0.5)},anchor=near ticklabel},
ylabel={{$E$} [{\myfont GPa}]},
ymin=0,ymax=5,
ytick={0,1,...,5},
ytick pos=left,
ytick align=outside,
]
\addplot [only marks,mark=*,mark options={scale=1.5,blue}]
table [x=x, y=y, y error=ey] {
x y ey
0.1 1.98 0.07
1 2.06 0.07
10 1.94 0.1
100 2.06 0.15
1000 2.2 0.12
};
\addlegendentry{\myfont machine direction}
\addplot [only marks,mark=square*,mark options={scale=1.5,blue}] table [x=x, y=y, y error=ey] {
x y ey
0.1 2.24 0.18
1 2.46 0.11
10 1.92 0.07
100 2.58 0.23
1000 2.3 0.32
};
\addlegendentry{\myfont transverse direction}
\addplot [black,dashed,semithick] table [x=x, y=y] {
x y
0.05 2.1
2000 2.1
};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}[trim axis left]
\begin{axis}[
xmode=log,
ymode=normal,
enable tick line clipping=false,
axis line style=semithick,
width=9cm,
height=7cm,
x tick style={black,semithick},
xmin=0.05,xmax=2000,
xtick={0.1,1,10,100,1000},
xtick pos=bottom,
minor x tick num=9,
xtick align=outside,
y tick style={black,semithick},
y label style=
{at={(ticklabel cs:0.5)},anchor=near ticklabel},
ylabel={{$\sigma_{max}$} [{\myfont MPa}]},
ymin=0,ymax=150,
ytick={0,50,...,150},
ytick pos=left,
ytick align=outside,
]
\addplot [only marks,mark=*,mark options={scale=1.5,blue}]
table [x=x, y=y, y error=ey] {
x y ey
0.1 89.4 5.9
1 88.2 3.75
10 79.4 2.61
100 84.4 5.26
1000 86.2 7.19
};
\addplot [only marks,mark=square*,mark options={scale=1.5,blue}] table [x=x, y=y, y error=ey] {
x y ey
0.1 101.7 12.04
1 114 6.45
10 82.1 0.6
100 103.7 8.56
1000 91.3 7.61
};
\addplot [black,dashed,semithick] table [x=x, y=y] {
x y
0.05 63
2000 63
};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}[trim axis left]
\begin{axis}[
xmode=log,
ymode=normal,
enable tick line clipping=false,
axis line style=semithick,
width=9cm,
height=7cm,
x tick style={black,semithick},
x label style=
{at={(ticklabel cs:0.5)},anchor=near ticklabel},
xlabel={{$t_a$} [{\myfont h}]},
xmin=0.05,xmax=2000,
xtick={0.1,1,10,100,1000},
xtick pos=bottom,
minor x tick num=9,
xtick align=outside,
y tick style={black,semithick},
y label style=
{at={(ticklabel cs:0.5)},anchor=near ticklabel},
ylabel={{$\epsilon_{max}$} [{\myfont -}]},
ymin=0,ymax=1.5,
ytick={0,0.5,...,1.5},
ytick pos=left,
ytick align=outside,
]
\addplot [only marks,mark=*,mark options={scale=1.5,blue}]
table [x=x, y=y, y error=ey] {
x y ey
0.1 0.8 0.06
1 1 0.08
10 0.8 0.1
100 1 0.07
1000 1 0.08
};
\addplot [only marks,mark=square*,mark options={scale=1.5,blue}] table [x=x, y=y, y error=ey] {
x y ey
0.1 0.8 0.1
1 0.7 0.08
10 1.2 0.04
100 0.7 0.06
1000 0.9 0.09
};
\addplot [black,dashed,thick] table [x=x, y=y] {
x y
0.05 0.045
2000 0.045
};
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}
答案1
罪魁祸首是legend style={at={(0.95,10.9)},...
。这会将图例向上移动,以至于绘图移到了页面下边界以下,从而使其消失。请注意,这些坐标以“绘图单位”为单位,因此 y 单位大致是绘图的高度。如果使用 ,legend style={at={(0.95,0.9)},...
则绘图会重新出现。除此之外,您正在加载许多与问题无关的包,并且使用的是非常旧版本的pgfplots
。我稍微降低了绘图的高度,以便它们可以很好地适应页面。
\documentclass{article}
\usepackage{pgfplots}
\pgfkeys{/pgf/number format/.cd,1000 sep={}}
\newcommand{\myfont}{\fontfamily{cmss}\selectfont}% used with mathpazo
\pgfplotsset{compat=1.16}
\pgfplotsset{label style={font=\Large},
tick label style={font=\Large}}
\pgfplotsset{error bars/.cd,
x dir=both, x explicit,
y dir=both, y explicit,
}
\pgfplotsset{/pgfplots/error bars/error bar style={semithick,black}}
%\pgfplotsset{/pgfplots/label shift={0pt}}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[trim axis left]
\begin{axis}[
xmode=log,
ymode=normal,
enable tick line clipping=false,
axis line style=semithick,
width=9cm,
height=6cm,
legend image post style={mark options={scale=1}},
legend style={at={(0.95,0.9)},draw=none,row sep=1pt,column sep=3pt},
legend cell align={left},
x tick style={black,semithick},
xmin=0.05,xmax=2000,
xtick={0.1,1,10,100,1000},
xtick pos=bottom,
minor x tick num=9,
xtick align=outside,
y tick style={black,semithick},
y label style=
{at={(ticklabel cs:0.5)},anchor=near ticklabel},
ylabel={{$E$} [{\myfont GPa}]},
ymin=0,ymax=5,
ytick={0,1,...,5},
ytick pos=left,
ytick align=outside,
]
\addplot [only marks,mark=*,mark options={scale=1.5,blue}]
table [x=x, y=y, y error=ey] {
x y ey
0.1 1.98 0.07
1 2.06 0.07
10 1.94 0.1
100 2.06 0.15
1000 2.2 0.12
};
\addlegendentry{\myfont machine direction}
\addplot [only marks,mark=square*,mark options={scale=1.5,blue}] table [x=x, y=y, y error=ey] {
x y ey
0.1 2.24 0.18
1 2.46 0.11
10 1.92 0.07
100 2.58 0.23
1000 2.3 0.32
};
\addlegendentry{\myfont transverse direction}
\addplot [black,dashed,semithick] table [x=x, y=y] {
x y
0.05 2.1
2000 2.1
};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}[trim axis left]
\begin{axis}[
xmode=log,
ymode=normal,
enable tick line clipping=false,
axis line style=semithick,
width=9cm,
height=6cm,
x tick style={black,semithick},
xmin=0.05,xmax=2000,
xtick={0.1,1,10,100,1000},
xtick pos=bottom,
minor x tick num=9,
xtick align=outside,
y tick style={black,semithick},
y label style=
{at={(ticklabel cs:0.5)},anchor=near ticklabel},
ylabel={{$\sigma_{max}$} [{\myfont MPa}]},
ymin=0,ymax=150,
ytick={0,50,...,150},
ytick pos=left,
ytick align=outside,
]
\addplot [only marks,mark=*,mark options={scale=1.5,blue}]
table [x=x, y=y, y error=ey] {
x y ey
0.1 89.4 5.9
1 88.2 3.75
10 79.4 2.61
100 84.4 5.26
1000 86.2 7.19
};
\addplot [only marks,mark=square*,mark options={scale=1.5,blue}] table [x=x, y=y, y error=ey] {
x y ey
0.1 101.7 12.04
1 114 6.45
10 82.1 0.6
100 103.7 8.56
1000 91.3 7.61
};
\addplot [black,dashed,semithick] table [x=x, y=y] {
x y
0.05 63
2000 63
};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}[trim axis left]
\begin{axis}[
xmode=log,
ymode=normal,
enable tick line clipping=false,
axis line style=semithick,
width=9cm,
height=6cm,
x tick style={black,semithick},
x label style=
{at={(ticklabel cs:0.5)},anchor=near ticklabel},
xlabel={{$t_a$} [{\myfont h}]},
xmin=0.05,xmax=2000,
xtick={0.1,1,10,100,1000},
xtick pos=bottom,
minor x tick num=9,
xtick align=outside,
y tick style={black,semithick},
y label style=
{at={(ticklabel cs:0.5)},anchor=near ticklabel},
ylabel={{$\epsilon_{max}$} [{\myfont -}]},
ymin=0,ymax=1.5,
ytick={0,0.5,...,1.5},
ytick pos=left,
ytick align=outside,
]
\addplot [only marks,mark=*,mark options={scale=1.5,blue}]
table [x=x, y=y, y error=ey] {
x y ey
0.1 0.8 0.06
1 1 0.08
10 0.8 0.1
100 1 0.07
1000 1 0.08
};
\addplot [only marks,mark=square*,mark options={scale=1.5,blue}] table [x=x, y=y, y error=ey] {
x y ey
0.1 0.8 0.1
1 0.7 0.08
10 1.2 0.04
100 0.7 0.06
1000 0.9 0.09
};
\addplot [black,dashed,thick] table [x=x, y=y] {
x y
0.05 0.045
2000 0.045
};
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}