是的,我知道有一个类似问题,但我需要一些最简单的东西。我想重现这幅图,我的想法是将两个箭头(对应于 m=+1/2 和 m=-1/2 的箭头)绘制为两个节点,然后将单词报告为节点的节点。我怎样才能将两个节点绘制为箭头?
\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[full]{textcomp}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
positioning}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}[
>={Stealth}
]
\begin{axis}[
grid=none,
xticklabel style={rotate=90, anchor=near xticklabel},
ymin=0,ymax=100,
xmin=0,xmax=100,
ticks=none,
axis lines = middle,
%y axis line style = {stealth-},
width=7cm,
height=7cm,
set layers,
x label style={at={(1,0)},right},
y label style={at={(0,1)},above},
xlabel={$B_0$},ylabel={$E$},
style={thick}
]
\addplot [blue,dotted,very thick,domain=0:80] {+0.4*x + 50};
\addplot [blue,dotted,very thick,domain=0:80] {-0.4*x + 50};
\draw[<->] (65,76) -- (65,24) node [midway, left] {$\Delta E$};
\end{axis}
\end{tikzpicture}
\end{document}
答案1
另一种方法是使用非常小的 MWE:
\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{nccmath}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usetikzlibrary{arrows.meta,
positioning}
\begin{document}
\begin{tikzpicture}[
> = Stealth,
lbl/.style = {font=\footnotesize, text=black, right}
]
\begin{axis}[
width=7cm,
height=8cm,
axis lines = left,
xmin=0, xmax=120,
ymin=0, ymax=100,
ticks=none,
xlabel={$B_0$}, ylabel={$E$},
no marks,
samples=2, domain=0:75,
every axis plot post/.append style={blue, very thick, densely dotted},
]
\addplot {+0.4*x + 50} node[lbl] {$\left\downarrow m = -\mfrac{1}{2}\right.$};
\addplot {-0.4*x + 50} node[lbl] {$\left\uparrow m = \mfrac{1}{2}\right.$};
\draw[<->] (65,76) -- node [lbl] {$\Delta E$} (65,24);
\end{axis}
\end{tikzpicture}
\end{document}