x축에 포인트(0.5066,-5.4)를 표시하고 싶습니다. 코드를 사용하려고 하면 \node[label={180:{($\varepsilon_{cor}$)}},circle,fill,inner sep=2pt] at (axis cs:0.5066,-5.4) {};
라벨의 위쪽 절반이 표시됩니다. 축의 점에 레이블을 지정하고 눈금처럼 축 아래에 표시하지만 눈금을 변경하지 않으려면 어떻게 해야 합니까?
\begin{tikzpicture}
\pgfplotsset{width=10cm,}
\begin{axis}[
xlabel={$\varepsilon$ /\si{\volt}},
ylabel={$\lg \vert I \vert$},
axis lines = box,
xmin=0.18, xmax=0.82,
ymin=-5.4, ymax=-2.9,
xtick={0.2,0.3,0.4,0.5,0.6,0.7,0.8},
ytick={-5,-4.5,-4,-3.5,-3,-2.5,-2},
ymajorgrids=true,
grid style=dashed,]
\addplot[
color=black,
mark=*, mark size=1.5,
]
coordinates {
(0.2208 ,-3.05061)
(0.2809 ,-3.1549 )
(0.3309 ,-3.26761)
(0.3709 ,-3.38722)
(0.4008 ,-3.49485)
(0.4208 ,-3.58503)
(0.4309 ,-3.63827)
(0.4408 ,-3.69897)
(0.4508 ,-3.76955)
(0.4609 ,-3.85387)
(0.4708 ,-3.95861)
(0.4759 ,-4.04576)
(0.4808 ,-4.09691)
(0.4858 ,-4.22185)
(0.4909 ,-4.30103)
(0.4958 ,-4.52288)
(0.4978 ,-4.52288)
(0.4998 ,-4.69897)
(0.5019 ,-5 )
(0.5039 ,-5 )
(0.5063 ,-5.41 )};
\addplot[
color=black,
mark=*, mark size=1.5,
]
coordinates {
(0.5066 ,-5.41 )
(0.5101 ,-5 )
(0.5121 ,-5 )
(0.5141 ,-4.69897)
(0.5161 ,-4.69897)
(0.521 ,-4.39794)
(0.526 ,-4.30103)
(0.5311 ,-4.1549 )
(0.536 ,-4.09691)
(0.5411 ,-4 )
(0.5511 ,-3.88606)
(0.5611 ,-3.79588)
(0.5711 ,-3.72125)
(0.5811 ,-3.67778)
(0.5911 ,-3.61979)
(0.611 ,-3.52288)
(0.6412 ,-3.40894)
(0.6811 ,-3.30103)
(0.7311 ,-3.19382)
(0.7911 ,-3.09691)};
\node[label={180:{($\varepsilon_{cor}$)}},circle,fill,inner sep=2pt] at (axis cs:0.5066,-5.4) {};
\end{axis}
\end{tikzpicture}
답변1
yshift
라벨을 이동하는 데 사용합니다 . 레이블이 있는 노드는 다음과 같습니다.
\node[label={[yshift=2ex]180:{($\varepsilon_{cor}$)}},circle,fill,inner sep=2pt] at (axis cs:0.5066,-5.4) {};
나머지는 지금 그대로 두면 결과는 다음과 같습니다.
편집하다
OP에서 요청했기 때문에 다른 솔루션을 포함합니다. 눈금 오른쪽에 레이블을 배치하려면 를 지정해야 합니다 label={[right,yshift...
.
나는 그것을 수동으로 정렬하는 자유를 얻었습니다.
\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\usepackage{amsmath,amssymb}
\usepackage{siunitx}
\begin{document}
\begin{tikzpicture}
\pgfplotsset{width=10cm,}
\begin{axis}[
xlabel={$\varepsilon$ /\si{\volt}},
ylabel={$\lg \vert I \vert$},
axis lines = box,
xmin=0.18, xmax=0.82,
ymin=-5.4, ymax=-2.9,
xtick={0.2,0.3,0.4,0.5,0.6,0.7,0.8},
ytick={-5,-4.5,-4,-3.5,-3,-2.5,-2},
ymajorgrids=true,
grid style=dashed,]
\addplot[
color=black,
mark=*, mark size=1.5,
]
coordinates {
(0.2208 ,-3.05061)
(0.2809 ,-3.1549 )
(0.3309 ,-3.26761)
(0.3709 ,-3.38722)
(0.4008 ,-3.49485)
(0.4208 ,-3.58503)
(0.4309 ,-3.63827)
(0.4408 ,-3.69897)
(0.4508 ,-3.76955)
(0.4609 ,-3.85387)
(0.4708 ,-3.95861)
(0.4759 ,-4.04576)
(0.4808 ,-4.09691)
(0.4858 ,-4.22185)
(0.4909 ,-4.30103)
(0.4958 ,-4.52288)
(0.4978 ,-4.52288)
(0.4998 ,-4.69897)
(0.5019 ,-5 )
(0.5039 ,-5 )
(0.5063 ,-5.41 )};
\addplot[
color=black,
mark=*, mark size=1.5,
]
coordinates {
(0.5066 ,-5.41 )
(0.5101 ,-5 )
(0.5121 ,-5 )
(0.5141 ,-4.69897)
(0.5161 ,-4.69897)
(0.521 ,-4.39794)
(0.526 ,-4.30103)
(0.5311 ,-4.1549 )
(0.536 ,-4.09691)
(0.5411 ,-4 )
(0.5511 ,-3.88606)
(0.5611 ,-3.79588)
(0.5711 ,-3.72125)
(0.5811 ,-3.67778)
(0.5911 ,-3.61979)
(0.611 ,-3.52288)
(0.6412 ,-3.40894)
(0.6811 ,-3.30103)
(0.7311 ,-3.19382)
(0.7911 ,-3.09691)};
\node[label={[right,yshift=2.1ex,xshift=0.3em]180:{($\varepsilon_{\mathrm{cor}})=0.5066$}},circle,fill,inner sep=2pt] at (axis cs:0.5066,-5.4) {};
\end{axis}
\end{tikzpicture}
\end{document}
생산:
편집2
축의 레이블 위치를 변경했습니다.
핵심 부분은 다음과 같습니다.
extra x ticks={0.5066},
extra x tick labels={$\varepsilon_{\mathrm{cor}} ({\scriptstyle 0.5066})$},
또한 축 틱을 수정했습니다.
\node[circle,fill,inner sep=1.5pt] at (axis cs:0.5066,-5.4) {};
코드는 다음과 같습니다
\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\usepackage{amsmath,amssymb}
\usepackage{siunitx}
\begin{document}
\begin{tikzpicture}
\pgfplotsset{width=10cm,}
\begin{axis}[
xlabel={$\varepsilon$ /\si{\volt}},
ylabel={$\lg \vert I \vert$},
axis lines = box,
xmin=0.18, xmax=0.82,
ymin=-5.4, ymax=-2.9,
xtick={0.2,0.4,0.6,0.8},
ytick={-5,-4,-3,-2},
ymajorgrids=true,
extra x ticks={0.5066},
extra x tick labels={$\varepsilon_{\mathrm{cor}} ({\scriptstyle 0.5066})$},
grid style=dashed,]
\addplot[
color=black,
mark=*, mark size=1.5,
]
coordinates {
(0.2208 ,-3.05061)
(0.2809 ,-3.1549 )
(0.3309 ,-3.26761)
(0.3709 ,-3.38722)
(0.4008 ,-3.49485)
(0.4208 ,-3.58503)
(0.4309 ,-3.63827)
(0.4408 ,-3.69897)
(0.4508 ,-3.76955)
(0.4609 ,-3.85387)
(0.4708 ,-3.95861)
(0.4759 ,-4.04576)
(0.4808 ,-4.09691)
(0.4858 ,-4.22185)
(0.4909 ,-4.30103)
(0.4958 ,-4.52288)
(0.4978 ,-4.52288)
(0.4998 ,-4.69897)
(0.5019 ,-5 )
(0.5039 ,-5 )
(0.5063 ,-5.41 )};
\addplot[
color=black,
mark=*, mark size=1.5,
]
coordinates {
(0.5066 ,-5.41 )
(0.5101 ,-5 )
(0.5121 ,-5 )
(0.5141 ,-4.69897)
(0.5161 ,-4.69897)
(0.521 ,-4.39794)
(0.526 ,-4.30103)
(0.5311 ,-4.1549 )
(0.536 ,-4.09691)
(0.5411 ,-4 )
(0.5511 ,-3.88606)
(0.5611 ,-3.79588)
(0.5711 ,-3.72125)
(0.5811 ,-3.67778)
(0.5911 ,-3.61979)
(0.611 ,-3.52288)
(0.6412 ,-3.40894)
(0.6811 ,-3.30103)
(0.7311 ,-3.19382)
(0.7911 ,-3.09691)};
\node[circle,fill,inner sep=1.5pt] at (axis cs:0.5066,-5.4) {};
\end{axis}
\end{tikzpicture}\end{document}
결과는 다음과 같습니다.
원래:
양쪽 축의 틱을 줄였습니다(원하는 대로 할 수 있음).
나는 x축에 추가 눈금을 제공했습니다.
extra x ticks
추가 눈금에 대한 레이블을 제공했습니다. (예를 들어
\small
숫자를 수정하거나 스타일을 미세 조정하고 싶을 수도 있습니다)중복되어 플롯의 라벨을 제거했습니다.
inner sep
축의 단일 틱을 로 줄1.5pt
였으며 미세 조정이 필요할 수 있습니다.
여기에서 픽업하시면 될 것 같아요.