我有一個帶有“{}”的資料表,我想保留這些字元。
我想從解析中取消該字元以列印在圖像上。
我知道我可以改變:
nodes near coords*={\label},
到
nodes near coords*={\{\label\}},
但這不允許我列印類似 {{N}{F}} 的內容
我目前的乳膠代碼:
\documentclass[tikz,border=10pt,multi]{standalone}
\usepackage{xparse}
\usetikzlibrary{3d}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\usepackage[utf8]{inputenc} %unicode support
\usepackage{lmodern}
\usepackage{graphicx}
\pgfplotsset{width=7cm,compat=1.12}
\begin{tikzpicture}
\begin{axis}[
separate axis lines,
axis lines=left,
every outer x axis line/.append style={-stealth},
every outer y axis line/.append style={-stealth},
xmin=-1,xmax=7,
ymin=-1,ymax=7,
xticklabels=\empty,
yticklabels=\empty,
zticklabels=\empty,
xlabel=$t$,
ylabel=$i$
]
\addplot[
nodes near coords*={\label},
nodes near coords align={right},
every node near coord/.style={font=\tiny,black},
mark=*,
only marks,
scatter,
visualization depends on={value \thisrow{label} \as \label}
] table[x=t,y=i,meta=label]{
t f i label
0 6 0 {F}
6 0 0 {T}
3 3 0 {N}
3 3 3 {FT}
0 6 3 {NF}
6 0 3 {NT}
3 3 6 {NFT}
};
% F - FT
\draw[black,-] (0,0) to (3,3);
% F - NF
\draw[black,-] (0,0) to (0,3);
% NF - NFT
\draw[black,-] (0,3) to (3,6);
% NFT - FT
\draw[black,-] (3,6) to (3,3);
% NFT - NT
\draw[black,-] (3,6) to (6,3);
% NT - T
\draw[black,-] (6,3) to (6,0);
% T - FT
\draw[black,-] (6,0) to (3,3);
% N - NF
\draw[black,-] (3,0) to (0,3);
% N - NT
\draw[black,-] (3,0) to (6,3);
\end{axis}
\end{tikzpicture}
\end{document}
感謝您的協助
答案1
如果你想列印大括號,你必須告訴 LaTeX:將你的資料改為
t f i label
0 6 0 \{F\}
6 0 0 \{T\}
3 3 0 \{N\}
3 3 3 \{FT\}
0 6 3 \{NF\}
6 0 3 \{NT\}
3 3 6 \{NFT\}
你得到
這是完整的程式碼。我只是把{
and}
改成\{
and\}
在相關的地方加上了\begin{document}
.
\documentclass[tikz,border=10pt,multi]{standalone}
\usepackage{xparse}
\usetikzlibrary{3d}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\usepackage[utf8]{inputenc} %unicode support
\usepackage{lmodern}
\usepackage{graphicx}
\pgfplotsset{width=7cm,compat=1.12}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
separate axis lines,
axis lines=left,
every outer x axis line/.append style={-stealth},
every outer y axis line/.append style={-stealth},
xmin=-1,xmax=7,
ymin=-1,ymax=7,
xticklabels=\empty,
yticklabels=\empty,
zticklabels=\empty,
xlabel=$t$,
ylabel=$i$
]
\addplot[
nodes near coords*={\label},
nodes near coords align={right},
every node near coord/.style={font=\tiny,black},
mark=*,
only marks,
scatter,
visualization depends on={value \thisrow{label} \as \label}
] table[x=t,y=i,meta=label]{
t f i label
0 6 0 \{F\}
6 0 0 \{T\}
3 3 0 \{N\}
3 3 3 \{FT\}
0 6 3 \{NF\}
6 0 3 \{NT\}
3 3 6 \{NFT\}
};
% F - FT
\draw[black,-] (0,0) to (3,3);
% F - NF
\draw[black,-] (0,0) to (0,3);
% NF - NFT
\draw[black,-] (0,3) to (3,6);
% NFT - FT
\draw[black,-] (3,6) to (3,3);
% NFT - NT
\draw[black,-] (3,6) to (6,3);
% NT - T
\draw[black,-] (6,3) to (6,0);
% T - FT
\draw[black,-] (6,0) to (3,3);
% N - NF
\draw[black,-] (3,0) to (0,3);
% N - NT
\draw[black,-] (3,0) to (6,3);
\end{axis}
\end{tikzpicture}
\end{document}