图上方向

图上方向

如何在 latex 中制作顺时针方向的图表?例如此图在此处输入图片描述

答案1

使用decorations.markingspatterns.meta库,图形绘制如下plot

\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{arrows.meta,
                decorations.markings,
                patterns.meta}

\begin{document}
    \begin{tikzpicture}[
decoration={
    markings,% switch on markings
    mark=between positions 0.2 and 0.8 step 0.2 with {\arrowreversed{stealth}}}
                        ]
\draw[postaction={decorate}, semithick,
      postaction={pattern={Lines[angle=45,distance={3pt},line width=0.2pt]},pattern color=gray}]
    plot[domain=2:-2] (\x,4-\x*\x);
\node[right] at (1,3) {$y=4-x^2$};
\node at (1,1) {$D$};
\draw   (-3,0) -- (3,0) node[below left] {$x$}
        (0,-1) -- (0,5) node[below left] {$y$};
  \end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

这是一个使用,一款综合性的图形软件包,此外还包含出色的文档和教程。

编辑:要在线上放置多个箭头,可以使用 TiZ'decorations-图书馆,如所示这个答案。得出:

\documentclass{scrartcl}
\usepackage{tikz}
\usetikzlibrary{patterns, quotes, positioning, decorations.markings}
\begin{document}
\begin{tikzpicture}[x=5mm, y=5mm, line width=0.75pt]
    \draw (0,-5) to["$y$" at end] (0,5);
    \draw (5,0) to["$x$" at start] (-5,0);
    \draw[
        pattern=north east lines, 
        decoration={
            markings,
            mark=at position 0.2 with {\arrow{<}},
            mark=at position 0.6 with {\arrow{<}},
            mark=at position 0.8 with {\arrow{<}}
        },
        postaction=decorate
    ]   (-2,0)  parabola[bend at end] 
        (0,4)   coordinate (S) 
                parabola[at start] (2,0)
                to cycle;
    \node[right=9pt of S] {$y = 4 - x^2$};
    \node[cyan, fill=white, inner sep=1pt, rounded corners] at (0.7,1.3) {$D$};
    \end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容