I've got a problem here. When I use the code like its shown below, it all works fine. BUT if I'm changing the xmax parameter to a smaller value like for example xmax=0.05 there are some errors occurring.
! Package pgfkeys Error: I do not know the key '/pgf/number format/at', to which you passed '(1,0)', and I am going to ignore it. Perhaps you misspelled it.See the pgfkeys package documentation for explanation.Type H for immediate help…. \end{axis}
! Package pgfkeys Error: I do not know the key '/pgf/number format/yshift', towhich you passed '-2em', and I am going to ignore it. Perhaps you misspelled it.See the pgfkeys package documentation for explanation.Type H for immediate help…. \end{axis}
! Package pgfkeys Error: I do not know the key '/pgf/number format/left' and Iam going to ignore it. Perhaps you misspelled it.See the pgfkeys package documentation for explanation.Type H for immediate help…. \end{axis}
! Package pgfkeys Error: I do not know the key '/pgf/number format/inner sep',to which you passed '0pt', and I am going to ignore it. Perhaps you misspelledit.See the pgfkeys package documentation for explanation.Type H for immediate help…. \end{axis}
\documentclass[12pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[german]{babel}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage{pgfplots}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\pgfplotsset{every axis/.append style={
font=\footnotesize,
%line width=1pt,
%tick style={line width=0.8pt}
}}
\pgfplotsset{every axis legend/.append style={at={(0.5,1.03)},anchor=south}}
\begin{axis}[ticklabel style={
/pgf/number format/.cd,
use comma},xlabel={$\sigma$ [-]},ylabel={$\Lambda$ [-]}, grid=major, legend columns=-1, xmin= 0, xmax= 0.1, cycle list name=black white, width= 0.5\textwidth]
\addplot table {test.dat};
\legend {Theorie}
\end{axis}
\end{tikzpicture}
\caption[]{}
\end{figure}
\end{document}
The data file test.dat looks like:
x y
0.0000734405 1.00
0.000734224 1.00002
0.00220151 1.00003
0.003667276 1.00007
0.005863111 1.00017
0.00732515 1.00026
0.0109739 1.00060
0.014613779 1.00106
0.021868115 1.00236
0.02908885 1.00416
If someone has an idea to scale the diagram to the right size it would realy help me. Any help will be greatly appreciated! Thanks!
Best Answer
The first problem occurs, because you are changing the directory (
.cd
) to thenumber format
, but then you don't switch it back totikz
which causes the above errors. As you easily will agree on,at
,yshift
,left
, andinner sep
do not belong to thenumber format
, but aretikz
keys.The second problem can be solved using the
scaled ticks
feature.Have a look at the following code and the inlcuded comments for more details. (For simplicity I directly included the data files of
test.dat
into the document itself.)