3

I'm trying to use the shape "circular sector" pgfman301a, p.706.

  1. I find no way to change length of axes (should be variable dependent of circle dimension).
  2. to position "apex" on 0,0
  3. why "minimum size" doesn't work?

The code:

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

pagesnippet of code result

  • 1
    minimum size has no effect because the node is bigger than 10cm. Try minimum size = 15cm. I don't know what you call the "apex" but if it is in your case the arc end anchor, you can set anchor=arc end. – Kpym Jan 4 at 16:03
  • @Kpym thank you for quick response. where one see, that the node is bigger than 10cm there is no value given by myself? Ok, in its height. what defines the node's extent? the content, ok (here minipage 3 cm). No way to control axes lengths? 'apex' means 'kegelspitze', i thought of as the part with smallest angle just as marmot has realized. – gizeh Jan 4 at 22:10
2

Kpym has already told you what I was going to tell you about minimum size. Other than that you need to use an appropriate anchor and only know how big the node will be after you have drawn it, so you can draw the grid below it afterwards on the 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}

enter image description here

  • great base for advance arises well of questions 1) \y1 function unclear 2) \p1 as a coordinate (new for me thx) 3)why "transform shape" necessary? 4) scale necessary? 5)effect of \typeout??? 6) can you explain the connection between drawing the help lines and shrinking to manageable dims of the node? – gizeh Jan 4 at 22:49
  • 1
    @gizeh \p1 and \y1 are part of the calc syntax. That is, after \p1=($(cs.north)-(cs.sector center)$) in \y1 is the y-value of the vector from (cs.sector center), i.e. the lowest point of the shape, to (cs.north), i.e. the north-most point. This is a standard trick to measure the dimension of some object or distance. The details can be found in section ` 13.5 CoordinateCalculations` of the pgfmanual. And no, I did only use scale because I found the resulting picture a bit largish, no deeper reason. transform shape is needed to subject the node shape to the transformation. – marmot Jan 4 at 22:54
  • so 1) scale AND transform necessary to shrink predefined node shape "circular sector"? 2) \typeout service of it? not in man – gizeh Jan 4 at 23:35
  • 1
    @gizeh I forgot to remove \typeout, which I only used to debug. (In general this is a nice core-level debugging tool, but not at all relevant to the answer.) And yes, you need to add transform shape to subject shapes to transformation like scaling and rotation. – marmot Jan 4 at 23:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.