我怎样才能使右侧的 y 轴点离图形稍微远一点?

我怎样才能使右侧的 y 轴点离图形稍微远一点?
\documentclass[tikz, border=1cm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{filecontents*}{data.csv}
group, x,  y 
1.10,  15, 0
1.10,  32,  32.2
1.10,  53,  52.1
1.10,  74,  91.5
\end{filecontents*}
\begin{document}
\begin{tikzpicture}
\pgfplotsset{xmin=0, xmax=100, ymin=1, ymax=1000}
\begin{axis}[legend style={nodes={scale=0.5, transform shape}}, legend image post style={mark=*}, ymode=log, ymin=1, ymax=1000,tick pos=right]
\end{axis} 

\begin{axis}[legend style={nodes={scale=0.5, transform shape}}, xlabel={X},
    ylabel={Y}, legend image post style={mark=*}, ymode=log, ymin=1, ymax=1000,tick pos=left]
\addplot table[x=x, y=y, col sep=comma] {data.csv};
\end{axis}
\end{tikzpicture}
\end{document}

答案1

您可以使用yticklabel shift键来移动标签:

\documentclass[tikz, border=1cm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{filecontents*}{data.csv}
group, x,  y 
1.10,  15, 0
1.10,  32,  32.2
1.10,  53,  52.1
1.10,  74,  91.5
\end{filecontents*}
\begin{document}
\begin{tikzpicture}
\pgfplotsset{xmin=0, xmax=100, ymin=1, ymax=1000}
\begin{axis}[legend style={nodes={scale=0.5, transform shape}}, legend image post style={mark=*}, ymode=log, ymin=1, ymax=1000,tick pos=right,yticklabel shift=1cm]
\end{axis} 

\begin{axis}[legend style={nodes={scale=0.5, transform shape}}, xlabel={X},
    ylabel={Y}, legend image post style={mark=*}, ymode=log, ymin=1, ymax=1000,tick pos=left]
\addplot table[x=x, y=y, col sep=comma] {data.csv};
\end{axis}
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容