我正在努力标记 x 轴

我正在努力标记 x 轴

亲爱的女士们先生们,使用以下代码,我得到了一个 x 轴以科学方式标记的图表。相反,我需要它像 0、0.02、0.04、0.06、0.08、0.1。你能教我怎么做吗?非常感谢,

\documentclass[border=3pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest,
    major grid style=gray!35,
    grid style={very thin},
    ticklabel style={font=\scriptsize},
    xlabel near ticks,
    ylabel near ticks,
    }


\begin{document}
\begin{tikzpicture}

\begin{axis}
[height=2in, width=3in,
xtick align=outside, ytick align=outside,
tick pos=left,
ylabel near ticks,
xlabel near ticks,
ytick={0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0},
ymajorgrids=false,
xmajorgrids=false,
xmin=0.0,xmax=0.1,ymin=0.0,ymax=1.0,
]

% these are the lines 
   \draw [dashed,blue] (0,0.292) .. controls (0.006,0.162) and (0.014,0.063) .. (0.027,0);
   \draw [dashed,blue] (0,0.903) .. controls (0.014,0.415) and (0.033,0.174) .. (0.081,0);
   \draw [dashed,blue] (0.013,1) .. controls (0.026,0.623) and (0.057,0.280) .. (0.100,0.117);
   \draw [dashed,blue] (0.026,1) .. controls (0.036,0.725) and (0.061,0.409) .. (0.1,0.243);
   \draw [dashed,blue] (0.040,1) .. controls (0.051,0.75) and (0.071,0.503) .. (0.1,0.337);
   \draw [dashed,blue] (0.053,1) .. controls (0.062,0.780) and (0.077,0.590) .. (0.1,0.406);
   \draw [dashed,blue] (0.062,1) .. controls (0.074,0.759) and (0.088,0.605) .. (0.1,0.490);
   \draw [dashed,blue] (0.071,1) .. controls (0.080,0.834) and (0.089,0.716) .. (0.1,0.602);
   \draw [dashed,blue] (0.08,1) .. controls (0.086,0.9) and (0.092,0.825) .. (0.1,0.756);
   \draw [dashed,blue] (0.089,1) .. controls (0.093,0.942) and (0.096,0.906) .. (0.1,0.870);
% these are the labels of lines
  \node[fill=white] at (0.013,0.1) {\scriptsize 0.05};
  \node[fill=white] at (0.06,0.09) {\scriptsize 0.1};
  \node[fill=white] at (0.07,0.27) {\scriptsize 0.2};
  \node[fill=white] at (0.075,0.38) {\scriptsize 0.3};
  \node[fill=white] at (0.078,0.49) {\scriptsize 0.4};
 \node[fill=white] at (0.076,0.64) {\scriptsize 0.5};
 \node[fill=white] at (0.088,0.62) {\scriptsize 0.6};
 \node[fill=white] at (0.080,0.85) {\scriptsize 0.7};
 \node[fill=white] at (0.092,0.82) {\scriptsize 0.8};
 \node[fill=white] at (0.093,0.93) {\scriptsize 0.9};

\end{axis}

\end{tikzpicture}
\end{document}

在此处输入图片描述

答案1

只需添加xticklabel style={/pgf/number format/.cd,fixed,precision=3}

\documentclass[border=3pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest,
    major grid style=gray!35,
    grid style={very thin},
    ticklabel style={font=\scriptsize},
    xlabel near ticks,
    ylabel near ticks,
    xticklabel style={/pgf/number format/.cd,fixed,precision=3}
    }


\begin{document}
\begin{tikzpicture}

\begin{axis}
[height=2in, width=3in,
xtick align=outside, ytick align=outside,
tick pos=left,
ylabel near ticks,
xlabel near ticks,
ytick={0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0},
ymajorgrids=false,
xmajorgrids=false,
xmin=0.0,xmax=0.1,ymin=0.0,ymax=1.0,
]

% these are the lines 
   \draw [dashed,blue] (0,0.292) .. controls (0.006,0.162) and (0.014,0.063) .. (0.027,0);
   \draw [dashed,blue] (0,0.903) .. controls (0.014,0.415) and (0.033,0.174) .. (0.081,0);
   \draw [dashed,blue] (0.013,1) .. controls (0.026,0.623) and (0.057,0.280) .. (0.100,0.117);
   \draw [dashed,blue] (0.026,1) .. controls (0.036,0.725) and (0.061,0.409) .. (0.1,0.243);
   \draw [dashed,blue] (0.040,1) .. controls (0.051,0.75) and (0.071,0.503) .. (0.1,0.337);
   \draw [dashed,blue] (0.053,1) .. controls (0.062,0.780) and (0.077,0.590) .. (0.1,0.406);
   \draw [dashed,blue] (0.062,1) .. controls (0.074,0.759) and (0.088,0.605) .. (0.1,0.490);
   \draw [dashed,blue] (0.071,1) .. controls (0.080,0.834) and (0.089,0.716) .. (0.1,0.602);
   \draw [dashed,blue] (0.08,1) .. controls (0.086,0.9) and (0.092,0.825) .. (0.1,0.756);
   \draw [dashed,blue] (0.089,1) .. controls (0.093,0.942) and (0.096,0.906) .. (0.1,0.870);
% these are the labels of lines
  \node[fill=white] at (0.013,0.1) {\scriptsize 0.05};
  \node[fill=white] at (0.06,0.09) {\scriptsize 0.1};
  \node[fill=white] at (0.07,0.27) {\scriptsize 0.2};
  \node[fill=white] at (0.075,0.38) {\scriptsize 0.3};
  \node[fill=white] at (0.078,0.49) {\scriptsize 0.4};
 \node[fill=white] at (0.076,0.64) {\scriptsize 0.5};
 \node[fill=white] at (0.088,0.62) {\scriptsize 0.6};
 \node[fill=white] at (0.080,0.85) {\scriptsize 0.7};
 \node[fill=white] at (0.092,0.82) {\scriptsize 0.8};
 \node[fill=white] at (0.093,0.93) {\scriptsize 0.9};

\end{axis}

\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容