
矢印にちょっとした問題があり、解決策が見つからないようです。この質問はTikZ 矢印の先端のみの塗りつぶし色を設定する(パス自体は設定しない)なぜなら、OP は矢印全体を 1 色にすることを意図していたからです。
矢印の先端を黒くし、矢印のパスを色付きにしたい場合は、単に draw=black
反対に、先端が色付きの黒いパスが必要だと言えばよいだけです。
それで、私は次のものを得ました:
これが私のコードです:
\documentclass[10pt]{article}
\usepackage[a4paper, margin=1cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{rotating}
\usepackage{amsmath}
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{arrows,backgrounds,decorations,shapes,shapes.multipart,positioning}
\pgfplotsset{compat=1.7}
\begin{document}
\definecolor{blue}{RGB}{0,127,255}
\tikzset{
opera/.style={fill=white, inner sep=0pt, right=3mm, text width= 5cm,font=\footnotesize},
tear/.style={draw=black, fill=blue, -*},.
}
\begin{tikzpicture}
\draw[tear] (12, 5) -- (12,4) -- (10,3) -- (10,2) node[opera] at (10,2){Not the path!};
\end{tikzpicture}
\end{document}
コードを最小限に抑えるために可能な限り削除するように努めたので、未使用のパッケージやライブラリがあっても心配しないでください。
可能な解決策として、または矢印のヒント>=stealth
を使用して色を設定しようとしたようなオプションを追加することを考えました。 どれも機能しませんでした。o
*
答え1
以下の答えはmarkings
およびに基づいていますpostaction
。
\documentclass[10pt]{article}
\usepackage[a4paper, margin=1cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{rotating}
\usepackage{amsmath}
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{arrows,backgrounds,decorations.markings,shapes,shapes.multipart,positioning}
\pgfplotsset{compat=1.7}
\begin{document}
\definecolor{blue}{RGB}{0,127,255}
\tikzset{
opera/.style={fill=white, inner sep=0pt, right=3mm, text width= 5cm,font=\footnotesize},
tear/.style={draw=black,-,
decoration={markings,mark=at position 1 with {\arrow[draw=black,fill=blue]{*}}},
postaction=decorate},.
}
\begin{tikzpicture}
\draw[tear] (12, 5) -- (12,4) -- (10,3) -- (10,2);
\end{tikzpicture}
\end{document}
これにより、次のようになります。
スタイルから矢印の先端を削除しtear
、decoration={markings,mark=at position 1 with {\arrow[draw=black,fill=blue]{*}}}
と を追加しましたpostaction=decorate
。この方法では、矢印の先端はパスを塗りつぶすことなく、セグメントの末尾に装飾として描画されます。また、矢印の先端のみが上書きされ、行全体が上書きされないように、postaction
で装飾を として読み込む必要があります。postaction=decorate
編集:以前のアプローチは(PGF 3.0.0 のリリースにより)廃止されました。
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\definecolor{myblue}{RGB}{0,127,255}
\tikzset{
opera/.style={
fill=white,
inner sep=0pt,
right=3mm,
text width= 5cm,
font=\footnotesize
},
tear/.style={
-{Circle[fill=myblue]} %new code, requires arrows.meta and at least PGF 3.0.0
},
}
\begin{document}
\begin{tikzpicture}
\draw[tear] (12, 5) -- (12,4) -- (10,3) -- (10,2) node[opera] {Not the path!};
\end{tikzpicture}
\end{document}