箭头符号两端的节点

箭头符号两端的节点

在此处输入图片描述

我有一张图,其中有 2 个带节点的箭头。对于红色箭头,我使用了\draw [<-,red,line width=0.6pt] (6,8) -- (30,8) node [right,black,draw=red,fill=white] {$\dfrac{a}{b}=\dfrac{3}{2}$};命令,它产生了一个指向左侧的箭头,节点位于其右端。我对蓝色箭头使用了命令\draw [->,blue,line width=0.6pt] (0.6,8) -- (3,8) node [left,black,draw=blue,fill=white] {$\dfrac{a}{b}=\dfrac{5}{2}$};,但它并没有产生指向右侧的箭头,节点位于其左端。有人能解释一下为什么它不起作用,我该如何修复它吗?以下是完整代码。

\documentclass{standalone}

\usepackage{amsmath,amssymb}
\usepackage{graphicx}% Include figure files
\usepackage{bm}
\usepackage[numbers,super,comma,sort&compress]{natbib}
\usepackage{tikz}
\usetikzlibrary{tikzmark,patterns}
\usetikzlibrary{arrows,arrows.meta,shapes.arrows}
\tikzset{>=latex}
\usepackage{pgfplots}
\usepackage{pgfplotstable}%fitting functions

\pgfplotsset{compat=newest}

\begin{document}

\begin{tikzpicture}
\begin{axis}[
    xmode=log,
    width=8cm,
    height=6cm,
    axis line style={line width=0.6pt},
    x label style=
        {at={(ticklabel cs:0.5)},anchor=near ticklabel},
    xlabel={$x$},
    xmin=0.1,xmax=1000,
    xtick={0.1,1,10,100,1000},
    xtick align=inside,
    y label style=
        {at={(ticklabel cs:0.5)},anchor=near ticklabel},
    ylabel={$y$},
    ymin=0,ymax=10,
    ytick={0,2,...,10},
    ytick align=inside,
]

\addplot [red,line width=0.6pt,domain=0.1:10,samples=200] {3*x/2};
\addplot [blue,line width=0.6pt,domain=0.1:10,samples=200] {5*x/2};

\draw [<-,red,line width=0.6pt] (6,8) -- (30,8) node [right,black,draw=red,fill=white] {$\dfrac{a}{b}=\dfrac{3}{2}$};
\draw [->,blue,line width=0.6pt] (0.6,8) -- (3,8) node [left,black,draw=blue,fill=white] {$\dfrac{a}{b}=\dfrac{5}{2}$};

\end{axis}
\end{tikzpicture}

\end{document}

相关内容