我的图表有问题。 我不明白为什么 latex 会把它放到我的描述中。我不得不手动指定 xticklabels。但 latex 仍然在那个位置给我那个数字。我想删除 10^2。我使用 texlive 和 texniccenter 2.02(64 位)
您可以将我的数据文件下载为 .csv,请参阅以下链接! https://www.dropbox.com/sh/53j803zmh9mpdw1/AADVWDeYcKUUSwWuO9ZrGZAYa?dl=0
谢谢
\documentclass{scrreprt}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepackage{pgfkeys}
\usepackage{xcolor}
\definecolor{myColor00}{HTML}{40699C}
\definecolor{myColor01}{HTML}{9E413E}
\definecolor{myColor02}{HTML}{7F9A48}
\definecolor{myColor03}{HTML}{664E83}
\pgfplotscreateplotcyclelist{color list}%
{myColor00,myColor01,myColor02,myColor03,myColor04,myColor05,myColor06,myColor07,myColor08,myColor09,myColor10,myColor11,myColor12}
\pgfplotscreateplotcyclelist{color list filled}%
{{myColor00, style={fill=myColor00}},{myColor01, style={fill=myColor01}},{myColor02, style={fill=myColor02}},{myColor03, style={fill=myColor03}},{myColor04, style={fill=myColor04}},{myColor05, style={fill=myColor05}},{myColor06, style={fill=myColor06}},{myColor07, style={fill=myColor07}},{myColor08, style={fill=myColor08}},{myColor09, style={fill=myColor09}},{myColor10, style={fill=myColor10}},{myColor11, style={fill=myColor11}},{myColor12, style={fill=myColor12}}}
\pgfplotscreateplotcyclelist{color marker list}{%
{myColor00, mark=o},{myColor01, mark=o},{myColor02, mark=o},{myColor03, mark=o},{myColor04, mark=o},{myColor05, mark=o},{myColor06, mark=o},{myColor07, mark=o},{myColor08, mark=o},{myColor09, mark=o},{myColor10, mark=o},{myColor11, mark=o},{myColor12, mark=o}}
\usepackage[caption=false]{subfig}
\usepackage[countmax]{subfloat}
\begin{document}
\begin{figure}
\centering
\subfloat[][Auskragung $A$~=~200~mm]{
\begin{tikzpicture}[trim axis left]
\begin{axis}[
font=\small,
/pgf/number format/.cd,
xtick={-0.04,-0.02,0,0.02,0.04},
xticklabels={$-0.04$,$-0.02$,$0$,$0.02$,$0.04$},
fixed,
use comma,
label style={font=\small},
y label style={at={(axis description cs:-0.095,.5)},anchor=south},
yticklabel pos=left,
width=0.51\textwidth,
cycle list name=color list,
xmin=-0.053, xmax=0.06,
ymin=-95, ymax=95,
xlabel=Verformungsweg $x$ {[mm]},
ylabel=Kraft $F$ {[N]},
legend style={
{font=\scriptsize},
cells={anchor=west},
legend pos=south west
}
]
\addplot[forget plot, color=black, very thin] coordinates { (-0.053,0) (0.06,0) };
\addplot[forget plot, color=black, very thin] coordinates { (0,-95) (0,95) };
\addplot+[forget plot, color=myColor00, smooth] table [col sep=tab,trim cells=true,x index=1,y index=0] {bilder/statischXY200mm.csv};
\addplot+[forget plot, color=myColor01, smooth] table [col sep=tab,trim cells=true,x index=3,y index=2] {bilder/statischXY200mm.csv};
\addplot+[forget plot, color=myColor02, smooth] table [col sep=tab,trim cells=true,x index=5,y index=4] {bilder/statischXY200mm.csv};
\addplot+[smooth, color=myColor03, densely dashdotdotted] table [col sep=tab,trim cells=true,x index=7,y index=6] {bilder/statischXY200mm.csv};
\addlegendentry{Mittelwert}
\end{axis}
\end{tikzpicture}
}
\subfloat[][Auskragung $A$~=~295~mm]{
\begin{tikzpicture}[trim axis right]
\begin{axis}[
font=\small,
/pgf/number format/.cd,
xtick={-0.05,0,0.05},
xticklabels={$-0.05$,$0$,$0.05$},
fixed,
use comma,
label style={font=\small},
yticklabel pos=right,
y label style={at={(axis description cs:1.195,.5)},anchor=south},
width=0.51\textwidth,
cycle list name=color list,
xmin=-0.096, xmax=0.13,
ymin=-80, ymax=80,
xlabel=Verformungsweg $x$ {[mm]},
ylabel=Kraft $F$ {[N]},
legend style={
{font=\scriptsize},
cells={anchor=west},
legend pos=south west
}
]
\addplot[forget plot, color=black, very thin] coordinates { (-0.096,0) (0.13,0) };
\addplot[forget plot, color=black, very thin] coordinates { (0,-80) (0,80) };
\addplot+[forget plot, color=myColor00, smooth] table [col sep=tab,trim cells=true,x index=1,y index=0] {bilder/statischXY295mm.csv};
\addplot+[forget plot, color=myColor01, smooth] table [col sep=tab,trim cells=true,x index=3,y index=2] {bilder/statischXY295mm.csv};
\addplot+[forget plot, color=myColor02, smooth] table [col sep=tab,trim cells=true,x index=5,y index=4] {bilder/statischXY295mm.csv};
\addplot+[smooth, color=myColor03, densely dashdotdotted] table [col sep=tab,trim cells=true,x index=7,y index=6] {bilder/statischXY295mm.csv};
\addlegendentry{Mittelwert}
\end{axis}
\end{tikzpicture}
}
\caption{Lineare Steifigkeitsmessung aller Positionen in $\pm~xy$-Richtung}
\label{fig:statischXY}
\end{figure}
\end{document}
答案1
您可以使用
scaled x ticks=false,
xticklabel style={/pgf/number format/.cd,fixed,precision=2},
自动格式化 xticklabels。
此外,可以更改图中颜色的顺序color list
和图的顺序以使用color list
图的循环列表。
\documentclass{scrreprt}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\definecolor{myColor00}{HTML}{40699C}
\definecolor{myColor01}{HTML}{9E413E}
\definecolor{myColor02}{HTML}{7F9A48}
\definecolor{myColor03}{HTML}{664E83}
\usepackage[caption=false]{subfig}
\usepackage[countmax]{subfloat}
\begin{document}
\begin{figure}
\pgfplotsset{
myaxis/.style={
font=\small,
scaled x ticks=false,
xticklabel style={/pgf/number format/.cd,fixed,precision=2},
width=0.51\textwidth,
xlabel=Verformungsweg $x$ {[mm]},
ylabel=Kraft $F$ {[N]},
legend style={
font=\scriptsize,
cells={anchor=west},
legend pos=south west
},
cycle list name=color list,
table/col sep=tab,
table/trim cells=true,
smooth,
}
}
\pgfplotscreateplotcyclelist{color list}{myColor03,myColor00,myColor01,myColor02}
\centering
\subfloat[][Auskragung $A$~=~200~mm]{
\begin{tikzpicture}[trim axis left]
\begin{axis}[
myaxis,
xtick={-0.04,-0.02,0,0.02,0.04},
y label style={at={(axis description cs:-0.095,.5)},anchor=south},
yticklabel pos=left,
xmin=-0.053, xmax=0.06,
ymin=-95,ymax=95,
]
\draw[very thin](current axis.left of origin)--(current axis.right of origin);
\draw[very thin](current axis.below origin)--(current axis.above origin);
\addplot+[densely dashdotdotted] table [x index=7,y index=6] {bilder/statischXY200mm.csv};
\addplot table [x index=1,y index=0] {bilder/statischXY200mm.csv};
\addplot table [x index=3,y index=2] {bilder/statischXY200mm.csv};
\addplot table [x index=5,y index=4] {bilder/statischXY200mm.csv};
\addlegendentry{Mittelwert}
\end{axis}
\end{tikzpicture}
}
\subfloat[][Auskragung $A$~=~295~mm]{
\begin{tikzpicture}[trim axis right]
\begin{axis}[
myaxis,
xtick={-0.05,0,0.05},
yticklabel pos=right,
y label style={at={(axis description cs:1.195,.5)},anchor=south},
xmin=-0.096, xmax=0.13,
ymin=-80,ymax=80,
]
\draw[very thin](current axis.left of origin)--(current axis.right of origin);
\draw[very thin](current axis.below origin)--(current axis.above origin);
\addplot+[densely dashdotdotted] table [x index=7,y index=6] {bilder/statischXY295mm.csv};
\addplot table [x index=1,y index=0] {bilder/statischXY295mm.csv};
\addplot table [x index=3,y index=2] {bilder/statischXY295mm.csv};
\addplot table [x index=5,y index=4] {bilder/statischXY295mm.csv};
\addlegendentry{Mittelwert}
\end{axis}
\end{tikzpicture}
}
\caption{Lineare Steifigkeitsmessung aller Positionen in $\pm~xy$-Richtung}
\label{fig:statischXY}
\end{figure}
\end{document}
答案2
我无法编译这个东西,所以我召唤我的水晶球,猜测你需要添加
scaled x ticks=false
选项到第一个绘图轴选项。
pgfplots
加载 TikZ。TikZ 加载pgfkeys
和xcolor
。因此,对于这四个包,您只需要第一个。