Füllung der Pfeile im „Kompass“ korrigieren

Füllung der Pfeile im „Kompass“ korrigieren

Wie korrigiere ich die Farbe in der Pfeilspitze? Sie füllt sich nicht so wie die Linienbreite. Außerdem werden Sie feststellen, dass der Pfeil berührt D. Wie drücke ich D nach unten? (Oder ist es am besten, es einfach manuell anzupassen?)

\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}

Antwort1

drawWenn Sie in der preactionOption durch den gleichen Stil ersetzen , der für die Linien ( fill=black!60) verwendet wird, erhalten Sie gräuliche Pfeile (das drawvon der Hauptaktion wird sowieso übernommen).

Sie kürzen auch den Pfeilteil (so dass er weiter reicht als die eigentliche Linie). Ich würde dies rückgängig machen (wie es normalerweise von PGF gemacht wird, wenn Sie Pfeile aufeinsPfad), d. h. die eigentliche Linie wird verkürzt, der Pfeil jedoch nicht.

Ich habe außerdem einen Stil definiert thicker line small arrows, der sein Argument in der Form annimmt <line width> in <color>und wiederholt verwendet werden kann, um verschiedene Zeilen auf die gleiche Weise zu formatieren.

Ich biete auch eine andere Möglichkeit (den thicker line small arrows mStil) an, die die markingsBibliothek zum Platzieren des Pfeils verwendet. Dies ist nicht so stabil wie die übliche preaction/ -Methode, aber Sie können den Pfeil trotzdem mit in postactionauf dem Pfad platzieren .1at position 1

Code 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}

Code 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}

Ausgabe

Bildbeschreibung hier eingeben

verwandte Informationen