"나침반"의 화살표 채우기 수정

"나침반"의 화살표 채우기 수정

화살촉의 색상을 어떻게 수정합니까? 선 너비만큼 채워지지 않습니다. 또한 화살표가 에 닿는 것을 볼 수 있습니다 D. D를 아래로 어떻게 누르나요? (아니면 수동으로 조정하는 것이 가장 좋습니까?)

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows, positioning, trees, mindmap, calc}
\begin{document}
\begin{tikzpicture} 
\node (a) at (9,7.5) {};
\node (b) at (9,4.5) {B};
\node (c) at (10.5,6) {};
\node (d) at (7.5,6) {D};

\path[draw=black!60,solid,line width=0.8mm,fill=black!60,preaction={-triangle 90,thin,draw,shorten >=-1mm}] (a) -- (b);
\path[draw=black!60,solid,line width=0.8mm,fill=black!60,preaction={-triangle 90,thin,draw,shorten >=-1mm}] (c) -- (d);
\end{tikzpicture}
\end{document}

답변1

draw옵션 의 을 preaction선( )에 사용된 것과 동일한 스타일로 바꾸면 fill=black!60회색 화살표가 표시됩니다( draw주 작업의 작업은 어쨌든 상속됩니다).

또한 화살표 부분을 줄입니다(실제 선보다 더 연장되도록). 나는 이것을 되돌릴 것입니다 (보통 화살표를 놓을 때 PGF가 수행하는 것처럼)하나경로), 즉 실제 선은 단축되지만 화살표는 단축되지 않습니다.

또한 동일한 방식으로 다양한 선의 스타일을 지정하는 데 반복적으로 사용할 수 있는 thicker line small arrows형식으로 인수를 취하는 스타일을 정의했습니다 .<line width> in <color>

또한 라이브러리를 사용하여 화살표를 배치하는 또 다른 방법( thicker line small arrows m스타일) 도 제공합니다 . 이것은 일반적인 / 방법 markings만큼 안정적이지는 않지만 어쨌든 in 에 의해 경로에 화살표를 배치할 수 있습니다 .preactionpostaction1at position 1

코드 1

\documentclass[tikz]{standalone}
\usetikzlibrary{arrows}
\colorlet{mygray}{black!60}
\tikzset{thicker line small arrows/.style args={#1in#2}{
    draw=#2,
    solid,
    line width=#1,
    shorten >=1mm,
    preaction={
        fill=#2,
        thin,
        -triangle 90,
        shorten >=0mm,
    }
}}
\begin{document}
\begin{tikzpicture} 
\node (a) at (9,7.5) {};
\node (b) at (9,4.5) {B};
\node (c) at (10.5,6) {};
\node (d) at (7.5,6) {D};

\path[thicker line small arrows=.8mm in mygray] (a) -- (b);
\path[thicker line small arrows=.4mm in green] (c) -- (d);
\end{tikzpicture}
\end{document}

코드 2

\documentclass[tikz]{standalone}
\usetikzlibrary{arrows, decorations.markings}
\colorlet{mygray}{black!60}
\tikzset{thicker line small arrows m/.style args={#1in#2}{
    draw=#2,
    solid,
    line width=#1,
    shorten >=1mm,
    decoration={
        markings,
        mark=at position 1.0 with {\arrow[fill=#2,thin]{triangle 90}}
    },
    postaction={decorate}
}}
\begin{document}    
\begin{tikzpicture} 
\node (a) at (9,7.5) {};
\node (b) at (9,4.5) {B};
\node (c) at (10.5,6) {};
\node (d) at (7.5,6) {D};

\path[thicker line small arrows m=.8mm in mygray] (a) -- (b);
\path[thicker line small arrows m=.4mm in green] (c) -- (d);
\end{tikzpicture}
\end{document}

산출

여기에 이미지 설명을 입력하세요

관련 정보