3

How can I get the first abscissa value in decimal form as 0.05 in (0.05,31.9)?

It is set to the scientist notation automatically.

\documentclass[border=2mm]{standalone}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{pgfplots}
\usepackage{siunitx}
\pgfplotsset{compat=1.11}
\begin{document}
\begin{tikzpicture}
  \begin{axis}[grid style=dashed,grid=both,ymin=0,ymax=70,xmax=0.35,xmin=0,
               minor tick num=1,axis lines = middle,xlabel=$x_1$,ylabel=T\;$(\si{\celsius})$,
                x label style={at={(axis description cs:1.1,0.03)},anchor=north},
                y label style={at={(axis description cs:0,1.0)},anchor=south},               
               ]
  \addplot+[color=red,mark=*,mark options={draw=red,fill=green},smooth]
    coordinates {
    (0.05,31.9)(0.10,30.1)(0.20,35.8)(0.31,65.4)
    };
  \end{axis}
\end{tikzpicture}
\end{document}
1
  • 1
    i recommend you to upgrade your pgfplots to recent version (1.16). with it you can write: x label style={at={(1,0)},anchor=west}, y label style={at={(0,1)},anchor=south}
    – Zarko
    Apr 4, 2019 at 14:29

1 Answer 1

6

You can do it by using fixed relative option as in

\documentclass[border=2mm]{standalone}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{pgfplots}
\usepackage{siunitx}
\pgfplotsset{compat=1.11}
\begin{document}
\begin{tikzpicture}
  \begin{axis}[grid style=dashed,grid=both,ymin=0,ymax=70,xmax=0.35,xmin=0,
               minor tick num=1,axis lines = middle,xlabel=$x_1$,ylabel=T\;$(\si{\celsius})$,
                x label style={at={(axis description cs:1.1,0.03)},anchor=north},
                y label style={at={(axis description cs:0,1.0)},anchor=south},     x tick label style={
                    /pgf/number format/.cd,
                    fixed relative,
                },          
               ]
  \addplot+[color=red,mark=*,mark options={draw=red,fill=green},smooth]
    coordinates {
    (0.05,31.9)(0.10,30.1)(0.20,35.8)(0.31,65.4)
    };
  \end{axis}
\end{tikzpicture}
\end{document}

to get:

enter image description here

1
  • Can you tell me how to show the "0" value on the axis? Apr 5, 2019 at 15:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .