我發現很難閱讀pgfplots 手冊,我可以參考哪些實體,例如具有更多資訊的錨節點。
例如,在下面的範例中,我可以引用哪些部分或全部實體?
\documentclass[10pt,border=3mm,tikz]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
title=hello,
xlabel=x,
]
\addplot[domain=-1:1] {(x-.2)^3 + 1};
\addplot[domain=-1:1] {x+1.5};
\end{axis}
\end{tikzpicture}
\end{document}
答案1
簡而言之,您至少可以參考:
- 實體,您可以透過命名
name= - 預定義實體,例如
current axis和current plot begincurrent plot end
請參閱下面的範例。筆記節點的順序和位置可能是相關的,請參閱current plot ...範例。筆記與節點一起使用的不同樣式選項。我建議在中查找更多詳細信息pgfplots-手冊。
% ~~~ 10.04.2024: Where can I name things like a node? ~~~~~~~~~
\documentclass[10pt,border=3mm,tikz]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
name=AX, % <<<
title=hello, % not here
title style={name=TS}, % <<<
xlabel=x, % not here
xlabel style={name=XL}, % <<<
ylabel=y, % not here
ylabel style={name=YL}, % <<<
]
\addplot[
domain=-1:1,
%name path=CRV, % needs fill between
%name=AP, % no
]{(x-.2)^3 + 1};
\addplot[domain=-1:1,]{x+1.5};
\end{axis}
% ~~~ current axis ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\node[anchor=west,red,circle,draw] at (current axis.east) {CA};
% ~~~ current plot ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\node[red,circle,draw] at (current plot begin) {CPb};
\node[red,circle,draw] at (current plot end) {CPe};
% ~~~ named axis, see above ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\node[anchor=west,teal] at (AX.south east) {AX};
\node[anchor=east,teal] at (AX.north west) {AX};
\node[teal] at (AX.outer north west){AX};
\node[teal] at (AX.origin) {AXorg};
\node[teal] at (AX.center) {AXcnt};
% ~~~ named styles ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\node[anchor=west,purple,draw] at (TS.east) {TS};
\node[anchor=west,purple,draw] at (XL.east) {XL};
\node[anchor=west,purple,draw] at (YL.east) {YL};
\end{tikzpicture}
\end{document}




