![TikZ 的路径装饰选项使 pgfplots 轴偏离轨道](https://linux22.com/image/271782/TikZ%20%E7%9A%84%E8%B7%AF%E5%BE%84%E8%A3%85%E9%A5%B0%E9%80%89%E9%A1%B9%E4%BD%BF%20pgfplots%20%E8%BD%B4%E5%81%8F%E7%A6%BB%E8%BD%A8%E9%81%93.png)
好吧,标题说明了一切:TikZ 的路径装饰选项破坏了 pgfplots 轴的格式。MWE 中包含了我关于 TikZ 的整个序言。如果我运行下面的 MWE,我会得到以下输出,但我不想取消注释该decoration={brace}
行。如果我保留它,它看起来像这样:
那么,保持活跃能解决这个问题吗decoration={brace}
?还是我犯了什么错误?
平均能量损失
\documentclass[
a4paper
]{scrartcl}
\usepackage{
tikz,
pgfplots,
amsmath
}
\usepackage[T1]{fontenc}
\usepackage{
lmodern,
textcomp
}
\usetikzlibrary{calc,trees,shadows,positioning,arrows,chains,shapes.geometric,%
decorations.pathreplacing,decorations.pathmorphing,shapes,%
matrix,shapes.symbols,patterns,intersections}
\pgfdeclarelayer{background layer}
\pgfdeclarelayer{foreground layer}
\pgfsetlayers{background layer,main,foreground layer}
\tikzset{
>=open triangle 45,
line/.style={draw, thick, ->},
kapitel/.style={
node distance=0.8cm,
rectangle,
drop shadow={opacity=0.5},
minimum width=4em,
minimum height=4em,
text width=12em,
font=\sffamily\bfseries,
draw={black!80, very thick},
fill=black!40,
%top color=white,
%bottom color=white!20!blue,
on chain},
every join/.style={->, thick, shorten >=1pt},
abschnitt/.style={
node distance=0.5cm,
rectangle,
drop shadow={opacity=0.5},
rounded corners,
minimum height=2em,
minimum width=4em,
text width=10em,
draw=black!80,
fill=black!20,
%shade,
font=\sffamily,
%top color=white!80!black,
%bottom color=white,
%text centered,
on chain},
decoration={brace},
}
\def\parsedate#1-#2!{%
\pgfmathparse{#1+1/12*(1#2-101)}%
}
\begin{document}
\begin{center}
\begin{tikzpicture}
\begin{axis}[
width=14cm, height=8cm,
axis lines*=left,
ymin=0,
enlargelimits=upper,
/pgf/number format/1000 sep={},
x coord trafo/.code={\expandafter\parsedate#1!}
]
\addplot [no markers] table [col sep=semicolon] {datadump.csv};%\datatable};
\end{axis}
\end{tikzpicture}
\end{center}
\end{document}
答案1
您可以通过设置在本地禁用装饰decoration={name=none}
:
\documentclass[
a4paper
]{scrartcl}
\usepackage{
tikz,
pgfplots,
amsmath
}
\usepackage[T1]{fontenc}
\usepackage{
lmodern,
textcomp
}
\usetikzlibrary{calc,trees,shadows,positioning,arrows,chains,shapes.geometric,%
decorations.pathreplacing,decorations.pathmorphing,shapes,%
matrix,shapes.symbols,patterns,intersections}
\pgfdeclarelayer{background layer}
\pgfdeclarelayer{foreground layer}
\pgfsetlayers{background layer,main,foreground layer}
\tikzset{
>=open triangle 45,
line/.style={draw, thick, ->},
kapitel/.style={
node distance=0.8cm,
rectangle,
drop shadow={opacity=0.5},
minimum width=4em,
minimum height=4em,
text width=12em,
font=\sffamily\bfseries,
draw={black!80, very thick},
fill=black!40,
%top color=white,
%bottom color=white!20!blue,
on chain},
every join/.style={->, thick, shorten >=1pt},
abschnitt/.style={
node distance=0.5cm,
rectangle,
drop shadow={opacity=0.5},
rounded corners,
minimum height=2em,
minimum width=4em,
text width=10em,
draw=black!80,
fill=black!20,
%shade,
font=\sffamily,
%top color=white!80!black,
%bottom color=white,
%text centered,
on chain},
decoration={brace},
}
\def\parsedate#1-#2!{%
\pgfmathparse{#1+1/12*(1#2-101)}%
}
\begin{document}
\begin{center}
\begin{tikzpicture}
\begin{axis}[
decoration={name=none},
width=14cm, height=8cm,
axis lines*=left,
ymin=0,
enlargelimits=upper,
]
\addplot [no markers] {rnd};%\datatable};
\end{axis}
\end{tikzpicture}
\end{center}
\end{document}