\documentclass{standalone}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\usepackage{tikz}
\begin{document}
\tikzset{mark options={mark size=2, line width=3pt}}
\begin{tikzpicture}
\begin{axis}[height=5cm,width=8cm,scale only axis,
xlabel= \textbf{Esfuerzo},
ylabel= \textbf{Impacto},
ymax = 45,
ymin = 15,
legend columns=0,
xticklabels={Bajo},
yticklabels={Bajo}]
\addplot[mark=none, black,very thick, dotted] coordinates {(0,30) (12,30)};
\addplot[mark=none, black,very thick, dotted] coordinates {(6,00) (06,60)};
\addplot[only marks, color=red,mark=*] coordinates { (1,31) (2,35) (2.5,20) (4,28) (5,19) (5,40) (7,20) (8,36) (9,35) (10,29) (7,29) (8,56) (9,35) (10,20) (12,24) };
%\addlegendentry{}
\node[] at (axis cs: 1,41.5) {Implementar};
\node[] at (axis cs: 12,41.5) {Desafío};
\node[] at (axis cs: 0,18) {Posible};
\node[] at (axis cs: 12,18) {Ignorar};
\end{axis}
\end{tikzpicture}
\end{document}
有什么建议可以获取像下图这样的标签吗?
答案1
我删除了figure
和measuredfigure
环境,因为figure
在中默认情况下不起作用standalone
,并且我不知道它measuredfigure
来自哪里。
您可以使用 为 命名axis
,name=ax
然后使用该名称来放置相对于它的节点。
\documentclass[border=5mm]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots} % loads tikz
\begin{document}
\begin{tikzpicture}
\begin{axis}[height=5cm,width=8cm,scale only axis,
ymax = 45,
ymin = 15,
legend columns=0,
xticklabels={},
yticklabels={},
mark options={ % unless you have multiple tikzpictures/axis, it makes more sense to have this here
mark size=2,
line width=3pt
},
name=ax % <-- added
]
\addplot[mark=none, black,very thick, dotted] coordinates {(0,30) (12,30)};
\addplot[mark=none, black,very thick, dotted] coordinates {(6,00) (06,60)};
\addplot[only marks, color=red,mark=*] coordinates { (1,31) (2,35) (2.5,20) (4,28) (5,19) (5,40) (7,20) (8,36) (9,35) (10,29) (7,29) (8,56) (9,35) (10,20) (12,24) };
%\addlegendentry{}
\node[] at (axis cs: 1,41.5) {Implementar};
\node[] at (axis cs: 12,41.5) {Desafío};
\node[] at (axis cs: 0,18) {Posible};
\node[] at (axis cs: 12,18) {Ignorar};
\end{axis}
\node [below left] at (ax.north west) {High};
\node [left] at (ax.west) {Payoff};
\node [above left] at (ax.south west) {Low};
\node [below right] at (ax.south west) {Easy};
\node [below] at (ax.south) {Difficulty};
\node [below left] at (ax.south east) {Hard};
\end{tikzpicture}
\end{document}