0

Sorry, this has to be extremly easy somehow but I don't find it... I want to label images (which works very well using \node[circle], but now I need to point to locations close to each other which I would like to do by having pointy things like in the mwe, but (unlike the mwe) I'd like to put them at a location, relative locations, label them, ... like I do with \node, like I indicate with the comment. The label should not rotate with the shape drawn (but I could do with the easy to place, scale and rotate shape adding a second labeling node for each). I simple don't see how I create \node with anything else than a predifined shape (or can I define own non-elemental shapes and use there? If so don't find that)

    \documentclass[border=1mm]{standalone}
    \usepackage{amsmath}
    \usepackage{tikz}
\begin{document}

    \begin{tikzpicture}

        %pointing circle
        \draw [fill=gray] (1,1) arc [start angle=0, end angle=270, radius=1cm] -- (1,0) -- (1,1);
        \node (n) at (0,1) {1};


        %\node[pointingcircle, rotate=-90, scale=0.5] (n) at (0,1) {1};

    \end{tikzpicture}
\end{document}

Roland
  • 6,655
  • 1
    Can you provide a hand-drawn sketch of what you want to achieve. From your MWE and your text I have no glue what yoou want do draw. – Roland Oct 22 '21 at 05:16
  • If you just want to draw a custom shape node see here. – Roland Oct 22 '21 at 05:17
  • Yes, the custom shape node drawing topic seems to cover it. Now trying to understand what of that I need (probably only little more than my mwe). Thanks. – Erik Itter Oct 22 '21 at 06:55
  • Are you after something like the node shapes defined by the shapes.callouts library? (Chapter 71.7, page 822, in the manual for version 3.1.9a.) Edit: sorry, hadn't actually compiled your example first. The callouts shapes aren't exactly what you show. – Torbjørn T. Oct 26 '21 at 17:26

1 Answers1

1

Based on predefined node shapes circle and rectangle, a custom node shape three forth circle is provided below.

\documentclass[border=1mm]{standalone}
\usepackage{amsmath}
\usepackage{tikz}

\makeatletter \pgfdeclareshape{three forth circle} {% \inheritsavedanchors[from=circle]% \pgfutil@for@anchor:=center,% north,south,west,east,% mid,mid west,mid east,base,base west,base east,% north west,north east,south west,% % south east% \do{% \inheritanchor[from=circle]{@anchor}% }% \anchor{south east}{% \centerpoint \pgf@xa=\radius \advance\pgf@x by\pgf@xa \advance\pgf@y by-\pgf@xa }% \backgroundpath{% \pgfutil@tempdima=\radius% \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}% \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}% \ifdim\pgf@xb<\pgf@yb% \advance\pgfutil@tempdima by-\pgf@yb% \else% \advance\pgfutil@tempdima by-\pgf@xb% \fi% %% draw border % move to south east \pgfpathmoveto{\pgfpointadd{\centerpoint}{\pgfqpoint{\pgfutil@tempdima}{-\pgfutil@tempdima}}}% % line to east \pgfpathlineto{\pgfpointadd{\centerpoint}{\pgfqpoint{\pgfutil@tempdima}{0pt}}}% % arc to south \pgfpatharc{0}{270}{\pgfutil@tempdima}% % close (line to south east) \pgfpathclose }% \anchorborder{% \pgf@xa=\pgf@x% \pgf@ya=\pgf@y% \edef\pgf@marshal{% \noexpand\pgfpointborderellipse {\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}} {\noexpand\pgfqpoint{\radius}{\radius}}% }% \ifdim\pgf@xa>0pt \ifdim\pgf@ya<0pt \edef\pgf@marshal{% \noexpand\pgfpointborderrectangle {\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}} {\noexpand\pgfqpoint{\radius}{\radius}}% }% \fi \fi \pgf@marshal% \pgf@xa=\pgf@x% \pgf@ya=\pgf@y% \centerpoint% \advance\pgf@x by\pgf@xa% \advance\pgf@y by\pgf@ya% }% } \makeatother

\begin{document} \begin{tikzpicture} \node[draw, fill=gray, three forth circle] (x) {x};

% test anchor &quot;south east&quot;
\draw[blue, -&gt;] (1,0) -- (x.south east);
% test \anchorborder
\draw[help lines] foreach \i in {10,20,...,360} {(\i:1cm) -- (x)};

\end{tikzpicture} \end{document}

enter image description here

muzimuzhi Z
  • 26,474