有没有一种简单的方法可以改变扇区的填充不透明度而不改变角度标签的不透明度?
我尝试使用,fill opacity=0.5
但标签 ( "$\alpha$"
) 也改变了。
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{quotes,angles}
\begin{document}
\begin{tikzpicture}
\draw (0.4,-0.5) -- (0.4,0.8); % a line to show if opacity works
\draw coordinate (a) at (3,-1);
\draw coordinate (b) at (0,0);
\draw coordinate (c) at (1,1);
\draw (a) -- (b) -- (c) pic ["$\alpha$",draw=orange,fill=orange!50,fill opacity=0.5,angle radius=1cm] {angle=a--b--c};
\end{tikzpicture}
\end{document}
答案1
Tikz 区分fill opacity
和text opacity
。如果没有同时设置,则定义fill opacity
会覆盖 的设置text opacity
。如果设置,text opacity=1
您将获得:
代码:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{quotes,angles}
\begin{document}
\begin{tikzpicture}
\draw (0.4,-0.5) -- (0.4,0.8); % a line to show if opacity works
\draw coordinate (a) at (3,-1);
\draw coordinate (b) at (0,0);
\draw coordinate (c) at (1,1);
\draw (a) -- (b) -- (c) pic ["$\alpha$",draw=orange,fill=orange!50,fill opacity=0.5, text opacity=1,angle radius=1cm] {angle=a--b--c};
\end{tikzpicture}
\end{document}
答案2
您可以使用语法为标签本身添加选项
"some text" {<options for the label>}, <other options>
因此pic ["$\alpha$" opacity=1,draw=orange,fill=orange!50,fill opacity=0.5,angle radius=1cm] {angle=a--b--c}
可以达到预期的效果。请注意,后面没有逗号" ... "
。在此特定情况下不需要括号,因为只有一个选项,即opacity
。
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{quotes,angles}
\begin{document}
\begin{tikzpicture}
\draw (0.4,-0.5) -- (0.4,0.8); % a line to show if opacity works
\draw coordinate (a) at (3,-1);
\draw coordinate (b) at (0,0);
\draw coordinate (c) at (1,1);
\draw (a) -- (b) -- (c) pic ["$\alpha$" opacity=1,draw=orange,fill=orange!50,fill opacity=0.5,angle radius=1cm] {angle=a--b--c};
\end{tikzpicture}
\end{document}