
微量元素:
\documentclass[]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.12}
\usetikzlibrary{plotmarks}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot[mark=*] coordinates
{(0,0)};
\node[blue] at (0,0) {\pgfuseplotmark{*}};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}
\addplot[mark=pentagon*] coordinates
{(0,0)};
\node[red] at (0,0) {\pgfuseplotmark{pentagon*}};
\end{axis}
\end{tikzpicture}
\end{document}
正如您在第一張圖片中看到的,兩個標記都位於同一位置,但在第二張圖片中則不同。我需要做什麼才能使節點中的標記位置與使用 繪製的標記位置相同\addplot
?
更新:日誌檔案中的版本號碼:
Package: pgfplots 2015/05/02 v1.12.1 Data Visualization (1.12.1)
Package: pgf 2013/12/18 v3.0.0 (rcs-revision 1.14)
File: pgflibraryplotmarks.code.tex 2013/07/20 v3.0.0 (rcs-revision 1.13)
其他問題(這或多或少是重複的):
答案1
這是因為 PGF 中的繪圖標記是為繪圖指令內部使用而準備的。它們不適合在文字模式下使用。
如果你想在文字模式下使用繪圖指令,你必須用圖片包圍它們,例如如下
\documentclass[]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.12}
\usetikzlibrary{plotmarks}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot[mark=pentagon*] coordinates
{(0,0)};
\node[red] at (0,0) {\tikz \pgfextra{\pgfuseplotmark{pentagon*}};};
\end{axis}
\end{tikzpicture}
\end{document}