좌표에 더 큰 원 표시를 추가하는 방식으로 컬러맵의 데이터 포인트를 강조 표시하려고 합니다 (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}