我想从标记的锚点(扇区中心和圆弧中心)开始,为预定义的节点形状“圆形扇区”pgfman301a,p 706 着色。绘制基于 pgfman301a,p.686。这是“轴上”绘制,但对我来说不可能。
\documentclass[]{standalone}
\usepackage{tikz}
\usetikzlibrary{mindmap,%to get annotations
decorations.fractals,
decorations.pathmorphing,
decorations.text,
positioning,
fadings,lindenmayersystems,
shadings,calendar,spy,math,calc,
shapes.geometric,
shadows,
fadings,backgrounds}
\begin{document}
\begin{tikzpicture}[scale=0.5,
transform shape
]
\tikzset{shape circlesec/.style={bottom color=red,
middle color=green,
top color=white,
shade,
shading=axis,
shading angle=180,
draw,
%fill=yellow!30,
line width=0.1pt,
inner xsep=0pt,
inner ysep=0pt,
}
}%end tikzset
\node [name=maerz,
shape=circular sector,
style=shape circlesec,
inner sep=0cm,
circular sector angle=30,
shape border uses incircle,
shape border rotate=-165,
anchor=sector center,inner sep=-2mm,%
minimum size = 6.6cm,%has an effect if the original size was smaller
shading angle=60,
]
(maerz) at (0,0) {};
%\draw[top color=white,bottom color=black,middle color=violet]%
% (maerz.arc center) circular sector (maerz.sector center);
\foreach \anchor/\placement in
{arc center/right, sector center/below left}
\draw[shift=(maerz.\anchor)] plot[mark=x] coordinates{(0,0)}
node[\placement] {\scriptsize\texttt{(maerz.\anchor)}};
\draw let \p1=($(maerz.north)-(maerz.sector center)$),\n1={int(1+\y1*1pt/1cm)}%
in
\pgfextra{\pgfmathtruncatemacro{\xmax}{\n1}
\pgfmathtruncatemacro{\nextx}{\xmax-1}
}%end pgfextra code
foreach \x in {-\xmax,-\nextx,...,\xmax}
{(\x,1pt) -- (\x,-1pt) node[anchor=north,font=\tiny]{ $\x$} }
foreach \y in {-\xmax,-\nextx,...,\xmax}
{(1pt,\y) -- (-1pt,\y) node[anchor=east,font=\tiny]{($\y$)}};
\end{tikzpicture}
\end{document}\grid
紫色绘图有效,人们可以看到旋转角度如何工作。但我不能。似乎需要更多。
\documentclass[]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,shapes.geometric,backgrounds}
\begin{document}
\begin{tikzpicture}[scale=0.5,
transform shape
]
\tikzset{shape circlesec/.append style={bottom color=red,
top color=green,
middle color=white,
shade,
shading=axis,
draw,
line width=0.1pt,
inner xsep=0pt,
inner ysep=0pt,
}
}%end tikzset
\node [name=maerz,
shape=circular sector,
style=shape circlesec,
inner sep=0cm,
circular sector angle=30,
shape border uses incircle,
shape border rotate=-165,
anchor=sector center,inner sep=-2mm,%
minimum size = 6.6cm,%has an effect if the original size was smaller
shading angle=15,
]
(maerz) at (0,0) {};
\draw[shade,shading angle=15,shading=axis,top color=white,bottom color=black,middle color=violet]%
(maerz.arc center) rectangle (maerz.sector center);
\foreach \anchor/\placement in
{arc center/right, sector center/below left}
\draw[shift=(maerz.\anchor)] plot[mark=x] coordinates{(0,0)}
node[\placement] {\scriptsize\texttt{(maerz.\anchor)}};
\draw let \p1=($(maerz.north)-(maerz.sector center)$),\n1={int(1+\y1*1pt/1cm)}%
in
\pgfextra{\pgfmathtruncatemacro{\xmax}{\n1}%set var xmax from value of n1 s.a.
\pgfmathtruncatemacro{\nextx}{\xmax-1}
}%end pgfextra code
foreach \x in {-\xmax,-\nextx,...,\xmax}
{(\x,1pt) -- (\x,-1pt) node[anchor=north,font=\tiny]{ $\x$} }
foreach \y in {-\xmax,-\nextx,...,\xmax}
{(1pt,\y) -- (-1pt,\y) node[anchor=east,font=\tiny]{($\y$)}};
\end{tikzpicture}
\end{document}
上述代码生成紫色绘图(编程不方便)
答案1
这是一些径向阴影。在这个非常好的答案。但是,即使我调整了参数,也无法使中间颜色非常明显。好吧,我只能说,这个漂亮阴影的作者留下了一个问题“后来——阴影被假定为 100bp 直径??”。如果她不知道,可怜的土拨鼠怎么会知道,特别是在冬眠的时候?我复制了代码,以便您或其他人可以玩它。
幸运的是,你希望中间颜色是白色,所以我可以使用 B 方案,在本例中即路径淡入淡出。这就是我的建议。
\documentclass[tikz]{standalone}
\makeatletter
% from https://tex.stackexchange.com/a/127045/121799
\tikzset{use path/.code=\tikz@addmode{\pgfsyssoftpath@setcurrentpath#1}}
\makeatother
\usetikzlibrary{calc,shapes.geometric,backgrounds,fadings}
\tikzfading[name=fade in,
inner color=transparent!100,
outer color=transparent!0]
\pgfdeclareradialshading[fradialcolour1,fradialcolour2,fradialcolour3]{fncyradial}{\pgfpoint{0}{0}}{% manual 1082-1083; later - shading is assumed to be 100bp diameter ??
color(0)=(fradialcolour1);
color(20bp)=(fradialcolour2);
color(40bp)=(fradialcolour3);
color(50bp)=(fradialcolour3)
}
\tikzset{% https://tex.stackexchange.com/a/372682/121799
fradial/.code={%
\tikzset{%
fancy radial/.cd,
shading=fncyradial,
#1
}
},
fancy radial/.search also={/tikz},
fancy radial/.cd,
fancy radial inner colour/.code={
\colorlet{fradialcolour1}{#1}
},
fancy radial mid colour/.code={
\colorlet{fradialcolour2}{#1}
},
fancy radial outer colour/.code={
\colorlet{fradialcolour3}{#1}
},
fancy radial inner colour=black,
fancy radial outer colour=black,
fancy radial mid colour=white,
inner color/.style={
fancy radial inner colour=#1,
},
outer color/.style={
fancy radial outer colour=#1,
},
mid color/.style={
fancy radial mid colour=#1,
},
}
\begin{document}
\begin{tikzpicture}[scale=0.5,
transform shape
]
\tikzset{shape circlesec/.style={
draw,
line width=0.1pt,
inner xsep=0pt,
inner ysep=0pt,
}
}%end tikzset
\node [name=maerz,save path=\pathA,
shape=circular sector,
style=shape circlesec,
inner sep=0cm,
circular sector angle=30,
shape border uses incircle,
shape border rotate=-165,
anchor=sector center,inner sep=-2mm,%
minimum size = 6.6cm,%has an effect if the original size was smaller
%shading angle=15,
]
(maerz) at (0,0) {};
\begin{scope}[on background layer]
\clip[use path=\pathA];
\shade[inner color=green,outer color=red,path fading=fade in] let
\p1=($(maerz.arc center)-(maerz.sector center)$),\n1={veclen(\y1,\x1)}
in (maerz.sector center) circle (\n1);
\end{scope}
\foreach \anchor/\placement in
{arc center/right, sector center/below left}
\draw[shift=(maerz.\anchor)] plot[mark=x] coordinates{(0,0)}
node[\placement] {\scriptsize\texttt{(maerz.\anchor)}};
\draw let \p1=($(maerz.north)-(maerz.sector center)$),\n1={int(1+\y1*1pt/1cm)}%
in
\pgfextra{\pgfmathtruncatemacro{\xmax}{\n1}
\pgfmathtruncatemacro{\nextx}{\xmax-1}
}%end pgfextra code
foreach \x in {-\xmax,-\nextx,...,\xmax}
{(\x,1pt) -- (\x,-1pt) node[anchor=north,font=\tiny]{ $\x$} }
foreach \y in {-\xmax,-\nextx,...,\xmax}
{(1pt,\y) -- (-1pt,\y) node[anchor=east,font=\tiny]{($\y$)}};
\end{tikzpicture}
\end{document}
当然,您可以通过\tikzfading[name=fade out,inner color=transparent!0,outer color=transparent!100]
从 pgfmanual 第 344 页叠加来添加另一种颜色。
旧答案:使用阴影时,讽刺的是,它middle color
必须放在最后,而不是中间。
\documentclass[]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,shapes.geometric}
\begin{document}
\begin{tikzpicture}[scale=0.5,
transform shape
]
\tikzset{shape circlesec/.style={bottom color=red,
top color=white,
middle color=green,
shade,
shading=axis,
shading angle=180,
draw,
%fill=yellow!30,
line width=0.1pt,
inner xsep=0pt,
inner ysep=0pt,
}
}%end tikzset
\node [name=maerz,
shape=circular sector,
style=shape circlesec,
inner sep=0cm,
circular sector angle=30,
shape border uses incircle,
shape border rotate=-165,
anchor=sector center,inner sep=-2mm,%
minimum size = 6.6cm,%has an effect if the original size was smaller
shading angle=60,
]
(maerz) at (0,0) {};
%\draw[top color=white,bottom color=black,middle color=violet]%
% (maerz.arc center) circular sector (maerz.sector center);
\foreach \anchor/\placement in
{arc center/right, sector center/below left}
\draw[shift=(maerz.\anchor)] plot[mark=x] coordinates{(0,0)}
node[\placement] {\scriptsize\texttt{(maerz.\anchor)}};
\draw let \p1=($(maerz.north)-(maerz.sector center)$),\n1={int(1+\y1*1pt/1cm)}%
in
\pgfextra{\pgfmathtruncatemacro{\xmax}{\n1}
\pgfmathtruncatemacro{\nextx}{\xmax-1}
}%end pgfextra code
foreach \x in {-\xmax,-\nextx,...,\xmax}
{(\x,1pt) -- (\x,-1pt) node[anchor=north,font=\tiny]{ $\x$} }
foreach \y in {-\xmax,-\nextx,...,\xmax}
{(1pt,\y) -- (-1pt,\y) node[anchor=east,font=\tiny]{($\y$)}};
\end{tikzpicture}
\end{document}
当使用您的代码时,我发现这些形状具有抵抗的意外行为fit
......