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

Andrew Swann
  • 95,762
BRMBU
  • 169
  • 1
    Replace your green path by \draw[green] (-90:.77) -- (30:.77) -- (150:.77)--cycle;. – Kpym Apr 29 '18 at 04:31

2 Answers2

8

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

erik
  • 12,673
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.

  • 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. –  Apr 29 '18 at 14:27