我正在尝试使用形状“圆形扇区”pgfman301a,p.706。
- 我发现没有办法改变轴的长度(应该是圆尺寸的变量)。
- 将“顶点”定位在 0,0
- 为什么“最小尺寸”不起作用?
代码:
\documentclass[]{scrartcl}
\usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{lmodern}
\usepackage[ngerman]{babel} \usepackage[margin=0cm,a4paper]{geometry}
\usepackage[a4,frame,center]{crop}
\usepackage{tikz}
\usetikzlibrary{mindmap,%to get annotations
decorations.fractals,
decorations.pathmorphing,
decorations.text,
positioning,
fadings,lindenmayersystems,shadings,calendar,spy,math,calc,
shapes.geometric,
intersections,
shadows,
fadings,backgrounds}
\begin{document}
\begin{tikzpicture}
\coordinate (circleorig) at (0cm,0cm);
\newdimen\circledim
\tikzmath{ \circledim=8 cm; }%end tikzmath
\tikzset{shape circlesec/.style={bottom color=black!30,
top color=red,
draw,
fill=yellow!30,
line width=0.1pt,
inner xsep=0pt,
inner ysep=0pt,
}
}%end tikzset
%help lines
%\draw [help lines,step=0.5cm] (0,5) grid (8,-8);
\foreach \x in {-8,-7.5,...,8}
\draw [yshift=0 cm](\x,1pt) -- (\x,-1pt) node[anchor=north]{\tiny $\x$};
\foreach \y in {-8,-7.5,...,8}
\draw [yshift=0 cm](1pt,\y) -- (-1pt,\y) node[anchor=east]{\tiny $\y$};
\node [name=j,
shape=circular sector,
style=shape circlesec,
inner sep=0cm,
circular sector angle=30,
shape border uses incircle,
shape border rotate=-105,
%minimum size = 10cm,%has no effect?
]
%at (sector center)
{\fbox{\begin{minipage}{3.5cm}
Januar: Bildung\\
der ersten silikaten\\
Erdrinde bald nach \\
dem prim\"aren,\\
dissonanten Akt.
\end{minipage}}
};
%\draw[shift=(j.south)] plot[mark=x] coordinates{(0,0)}
% node[right] {j.south};
\end{tikzpicture}
\end{document}
答案1
Kpym 已经告诉了你我要告诉你的关于 的内容minimum size
。除此之外,你需要使用适当的锚点,并且只知道绘制节点后节点的大小,这样你就可以随后在 上绘制其下方的网格background layer
。
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{math,calc,shapes.geometric,backgrounds}
\begin{document}
\begin{tikzpicture}[scale=0.5,transform shape]
\coordinate (circleorig) at (0cm,0cm);
\newdimen\circledim
\tikzmath{ \circledim=8 cm; }%end tikzmath
\tikzset{shape circlesec/.style={bottom color=black!30,
top color=red,
draw,
fill=yellow!30,
line width=0.1pt,
inner xsep=0pt,
inner ysep=0pt,
}
}%end tikzset
\node [name=j,
shape=circular sector,
style=shape circlesec,
inner sep=0cm,
circular sector angle=30,
shape border uses incircle,
shape border rotate=-105,
anchor=sector center,inner sep=-2mm,
%minimum size = 20cm,%has an effect if the original size was smaller
]
(cs) at (0,0)
{\fbox{\begin{minipage}{3.5cm}
Januar: Bildung\\
der ersten silikaten\\
Erdrinde bald nach \\
dem prim\"aren,\\
dissonanten Akt.
\end{minipage}}
};
\begin{scope}[on background layer]
%help lines
%\draw [help lines,step=0.5cm] (0,5) grid (8,-8);
\draw let \p1=($(cs.north)-(cs.sector center)$),\n1={int(1+\y1*1pt/1cm)}
in
\pgfextra{\pgfmathtruncatemacro{\xmax}{\n1}\pgfmathtruncatemacro{\nextx}{\xmax-1}\typeout{\n1}}
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{scope}
%\draw[shift=(j.south)] plot[mark=x] coordinates{(0,0)}
% node[right] {j.south};
\end{tikzpicture}
\end{document}