4

I have a lot of data points that have been plotted in graphs saved as .png. I am making a table of these points with symbol as one of the columns.

Using the tikz package, I am able to obtain a red dot inscribed in a blue circle but I am unable to superscribe a down triangle on it. The incomplete triangle appears beside it.

The code I have written is as follows.

\usepackage{tikz}

\newcommand{\bluetrireddot}[1][0.3]{%
\begin{tikzpicture}[scale=#1]
\draw[fill=red,red] (0,0) circle (0.15);
\draw[blue] (0,0) circle (0.35);
\draw[green] (0,1) -- (1,0) -- (2,1);
\end{tikzpicture}%
}

The output is as shown.

enter image description here

What I want is something like this (this image is from the graph):

enter image description here

  • 1
    Replace your green path by \draw[green] (-90:.77) -- (30:.77) -- (150:.77)--cycle;. – Kpym Apr 29 '18 at 4:31
8

I think that this is a situation where the pic thingy might make sense.

\documentclass{article}
\usepackage{tikz}
\tikzset{blueredgreen/.pic={%
\fill[red] (0,0) circle (0.15);
\draw[thick,green!60!black] (30:0.5) -- (150:0.5) -- (270:0.5) -- cycle;  
\draw[thick,blue] (0,0) circle (0.25);}
}
\newcommand{\bluetrireddot}[1][0.3]{%
\begin{tikzpicture}
\pic[scale=#1] {blueredgreen};
\end{tikzpicture}%
}
\begin{document}
Hello \bluetrireddot symbol!
\end{document}

enter image description here

BTW, there are dedicated libraries for pgfplotmarks, see p. 678 of the pgfmanual (not pgfplots manual!), which you may also consider.

|improve this answer|||||
  • I don't understand what the point of the pic is...? – Najib Idrissi Apr 29 '18 at 12:34
  • @NajibIdrissi As explained in the pgfmanual on p. 251: A “pic” is a “short picture” (hence the short name...) . And one of the points is that, if the user ever decides to use the symbol inside a TikZ picture, then there is a simple syntax that allows her/him to use it without nesting TikZ pictures. – user121799 Apr 29 '18 at 14:27
9

You could use a triangular node from the shapes library.

Edit: I incorporated the rotation, but also changed the command to scale properly.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes}
\newcommand{\bluetrireddot}[1][0.5]{%
\begin{tikzpicture}
\node(t)[green,regular polygon,regular polygon sides=3,rotate=180,draw,scale=#1] at (0,0){};
\node at (t.center)[circle,fill=red,scale=0.5*#1]{};
\node at (t.center)[circle,blue,draw,scale=#1]{};
\end{tikzpicture}}
\begin{document}
\dots images \bluetrireddot\ acquired \dots
\end{document}

enter image description here

|improve this answer|||||
  • 1
    You can also use rotate=180 in the node options to flip it upside down. – ichbinallen Apr 29 '18 at 3:23
  • Thanks @ichbinallen, I completely overlooked the orientation of the triangle! – erik Apr 29 '18 at 7:55

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.