在颜色图上突出显示数据点

在颜色图上突出显示数据点

我正在尝试通过在坐标处添加更大的圆圈标记来突出显示颜色图上的数据点(3.6,47)。在此示例中(参见下图),我只是在此坐标处添加了额外的点,并选择了接近我看到的颜色。我想知道是否有办法添加与颜色图中完全相同的颜色的完全相同的点。在此处输入图片描述

这是我使用的代码

\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

您可以绘制单个坐标的散点图。我删除了所有不必要的包和选项。

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

在此处输入图片描述

相关内容