3

I am trying to highlight a data point on a colormap in a way to add a bigger circle mark at the coordinates (3.6,47). In this example (see the plot below) I just added additional point at this coordinates and chose the color close to what I see. I wonder if there is a way to add the exact same point with the exact same colors as in the colormap.enter image description here

Here is the code I used

\documentclass{standalone}

\usepackage{amsmath,amssymb}
\usepackage{graphicx}
\usepackage{dcolumn}
\usepackage{bm}
\usepackage[numbers,super,comma,sort&compress]{natbib}
\usepackage{tikz}
\usetikzlibrary{tikzmark,patterns}
\usetikzlibrary{arrows,arrows.meta,shapes.arrows,shapes.geometric}
\tikzset{>=latex}


\usepackage{pgfplots}
\usepackage{pgfplotstable}
\usepgfplotslibrary{fillbetween}
\usepackage{xcolor}
\definecolor{dgreen}{rgb}{0.0, 0.5, 0.0}

\pgfplotsset{
colormap={greenyellow}{rgb255(0cm)=(0,128,0); rgb255(1cm)=(255,255,0)}
}


\pgfkeys{/pgf/number format/.cd,1000 sep={}}

\pgfplotsset{compat=newest,
    every axis x label/.append style={black},
    every axis y label/.append style={black},
    every major grid/.append style={gray!50,line width=0.4pt},
    every minor grid/.append style={gray!50,line width=0.4pt},
    every major tick/.append style={black,line width=0.6pt},
    every minor tick/.append style={black,line width=0.6pt},
    every x tick label/.append style={black},
    every y tick label/.append style={black}
}


\begin{document}

\begin{tikzpicture}
\begin{axis}[colormap/greenyellow,
    enable tick line clipping=false,
    axis on top=true,
    width=8cm,
    height=6cm,
    axis line style={line width=0.6pt},
    x label style={at=(ticklabel cs:0.5),anchor=near ticklabel},
    xmin=0,xmax=5,
    xtick={0,1,...,5},
    xtick pos=bottom,
    xtick align=outside,
    xlabel={$x$},
    y label style={at=(ticklabel cs:0.5),anchor=near ticklabel},
    ymin=0,ymax=80,
    ytick={0,20,...,80},
    ytick pos=left,
    ytick align=outside,
    ylabel={$y$}
]

\addplot [scatter,mark=*,mark options={mark size=1},samples=200,domain=0:5] {100*((1/(-0.088540*x+1))-1)};

\addplot [only marks,mark=*,mark options={mark size=3,white,line width=0.8pt,fill=dgreen}] coordinates {(3.6,47)};


\end{axis}
\end{tikzpicture}

\end{document}```

1 Answer 1

3

You could plot the scatter for single coordinate. I remove all unnecessary packages and options.

\documentclass{standalone}
\usepackage{pgfplots}
\pgfkeys{
/pgf/number format/.cd,
1000 sep={}
}
\pgfplotsset{
compat=newest,
every major grid/.append style={gray!50,line width=0.4pt},
every minor grid/.append style={gray!50,line width=0.4pt},
every major tick/.append style={black,line width=0.6pt},
every minor tick/.append style={black,line width=0.6pt},
colormap={greenyellow}{rgb255(0cm)=(0,128,0); rgb255(1cm)=(255,255,0)}
}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
colormap/greenyellow,
axis on top=true,
width=8cm,
height=6cm,
axis line style={line width=0.6pt},
xmin=0,xmax=5,
xtick pos=bottom,
xtick align=outside,
xlabel={$x$},
ymin=0,ymax=80,
ytick pos=left,
ytick align=outside,
ylabel={$y$}
]

\addplot [scatter,mark=*,mark options={mark size=1},samples=200,domain=0:5] {100*((1/(-0.088540*x+1))-1)};

\addplot [scatter,mark=*,mark options={mark size=3}] coordinates {(3.6,{100*((1/(-0.088540*3.6+1))-1)})};

\addplot [scatter,mark=*,mark options={mark size=3}] coordinates {(1.5,{100*((1/(-0.088540*1.5+1))-1)})};
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .