1

i have a problem with my graph. i'd like to remove the 10^2 i can't figure out why latex puts this into my description. i had to specify the xticklabels manually. but latex still gives me that number on that position. i'd like to remove the 10^2. i use texlive and texniccenter 2.02 (64bit)

you can download my data files as .csv, see the following link! https://www.dropbox.com/sh/53j803zmh9mpdw1/AADVWDeYcKUUSwWuO9ZrGZAYa?dl=0

thank you

\documentclass{scrreprt}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepackage{pgfkeys}
\usepackage{xcolor}
\definecolor{myColor00}{HTML}{40699C}
\definecolor{myColor01}{HTML}{9E413E}
\definecolor{myColor02}{HTML}{7F9A48}
\definecolor{myColor03}{HTML}{664E83}
\pgfplotscreateplotcyclelist{color list}%
{myColor00,myColor01,myColor02,myColor03,myColor04,myColor05,myColor06,myColor07,myColor08,myColor09,myColor10,myColor11,myColor12}
\pgfplotscreateplotcyclelist{color list filled}%
{{myColor00, style={fill=myColor00}},{myColor01, style={fill=myColor01}},{myColor02, style={fill=myColor02}},{myColor03, style={fill=myColor03}},{myColor04, style={fill=myColor04}},{myColor05, style={fill=myColor05}},{myColor06, style={fill=myColor06}},{myColor07, style={fill=myColor07}},{myColor08, style={fill=myColor08}},{myColor09, style={fill=myColor09}},{myColor10, style={fill=myColor10}},{myColor11, style={fill=myColor11}},{myColor12, style={fill=myColor12}}}
\pgfplotscreateplotcyclelist{color marker list}{%
{myColor00, mark=o},{myColor01, mark=o},{myColor02, mark=o},{myColor03, mark=o},{myColor04, mark=o},{myColor05, mark=o},{myColor06, mark=o},{myColor07, mark=o},{myColor08, mark=o},{myColor09, mark=o},{myColor10, mark=o},{myColor11, mark=o},{myColor12, mark=o}}
\usepackage[caption=false]{subfig}
\usepackage[countmax]{subfloat}


\begin{document}
\begin{figure}
\centering
\subfloat[][Auskragung $A$~=~200~mm]{
\begin{tikzpicture}[trim axis left]
\begin{axis}[
      font=\small,
      /pgf/number format/.cd,
      xtick={-0.04,-0.02,0,0.02,0.04},
       xticklabels={$-0.04$,$-0.02$,$0$,$0.02$,$0.04$},
      fixed,
    use comma,
      label style={font=\small},
      y label style={at={(axis description cs:-0.095,.5)},anchor=south},
      yticklabel pos=left,
      width=0.51\textwidth,
    cycle list name=color list,
     xmin=-0.053, xmax=0.06,
    ymin=-95,   ymax=95,
     xlabel=Verformungsweg $x$ {[mm]},
     ylabel=Kraft $F$ {[N]},
     legend style={
        {font=\scriptsize},
         cells={anchor=west},
         legend pos=south west
      }
   ]
  \addplot[forget plot, color=black, very thin] coordinates { (-0.053,0) (0.06,0) };
  \addplot[forget plot, color=black, very thin] coordinates { (0,-95) (0,95) };

      \addplot+[forget plot, color=myColor00, smooth] table [col sep=tab,trim cells=true,x index=1,y index=0] {bilder/statischXY200mm.csv};

  \addplot+[forget plot, color=myColor01, smooth] table [col sep=tab,trim cells=true,x index=3,y index=2] {bilder/statischXY200mm.csv};

  \addplot+[forget plot, color=myColor02, smooth] table [col sep=tab,trim cells=true,x index=5,y index=4] {bilder/statischXY200mm.csv};

    \addplot+[smooth, color=myColor03, densely dashdotdotted] table [col sep=tab,trim cells=true,x index=7,y index=6] {bilder/statischXY200mm.csv};
    \addlegendentry{Mittelwert}

\end{axis}
\end{tikzpicture}
}
\subfloat[][Auskragung $A$~=~295~mm]{
\begin{tikzpicture}[trim axis right]
\begin{axis}[
      font=\small,
      /pgf/number format/.cd,
      xtick={-0.05,0,0.05},
       xticklabels={$-0.05$,$0$,$0.05$},
      fixed,
      use comma,
      label style={font=\small},
      yticklabel pos=right,
     y label style={at={(axis description cs:1.195,.5)},anchor=south},
      width=0.51\textwidth,
    cycle list name=color list,
     xmin=-0.096, xmax=0.13,
    ymin=-80,   ymax=80,
     xlabel=Verformungsweg $x$ {[mm]},
     ylabel=Kraft $F$ {[N]},
     legend style={
        {font=\scriptsize},
         cells={anchor=west},
         legend pos=south west
      }
   ]
  \addplot[forget plot, color=black, very thin] coordinates { (-0.096,0) (0.13,0) };
  \addplot[forget plot, color=black, very thin] coordinates { (0,-80) (0,80) };

      \addplot+[forget plot, color=myColor00, smooth] table [col sep=tab,trim cells=true,x index=1,y index=0] {bilder/statischXY295mm.csv};

  \addplot+[forget plot, color=myColor01, smooth] table [col sep=tab,trim cells=true,x index=3,y index=2] {bilder/statischXY295mm.csv};

  \addplot+[forget plot, color=myColor02, smooth] table [col sep=tab,trim cells=true,x index=5,y index=4] {bilder/statischXY295mm.csv};

  \addplot+[smooth, color=myColor03, densely dashdotdotted] table [col sep=tab,trim cells=true,x index=7,y index=6] {bilder/statischXY295mm.csv};
  \addlegendentry{Mittelwert}

\end{axis}
\end{tikzpicture}
}
\caption{Lineare Steifigkeitsmessung aller Positionen in $\pm~xy$-Richtung}
\label{fig:statischXY}
\end{figure} 
\end{document}
  • Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Nov 23 '14 at 20:01
  • By the way, your code misses at least a \end{document} command – user31729 Nov 23 '14 at 20:01
  • I hope, someone will answer your question ;-) And I hope, that someone will pretty - print your code above :-P – user31729 Nov 23 '14 at 20:44
  • me too. can you tell me at least how i enter the whole thing as a code, like you corrected it? can't find that mistake either... – goodstuff Nov 23 '14 at 20:48
  • 1
    Just enter your code (copy it from your editor) and then mark the whole code with the mouse, then press CTRL - K or on the {} button above. – user31729 Nov 23 '14 at 20:50
2

You can use

scaled x ticks=false, 
xticklabel style={/pgf/number format/.cd,fixed,precision=2},

to format the xticklabels automatically.

Additionally the order of the colors in the color list and the order of the plots could be changed to use the cycle list color list for the plots.

enter image description here

\documentclass{scrreprt}

\usepackage{pgfplots} 
\pgfplotsset{compat=newest} 

\definecolor{myColor00}{HTML}{40699C} 
\definecolor{myColor01}{HTML}{9E413E} 
\definecolor{myColor02}{HTML}{7F9A48} 
\definecolor{myColor03}{HTML}{664E83} 

\usepackage[caption=false]{subfig} 
\usepackage[countmax]{subfloat} 

\begin{document} 
\begin{figure}
\pgfplotsset{ 
    myaxis/.style={ 
      font=\small,
      scaled x ticks=false,
      xticklabel style={/pgf/number format/.cd,fixed,precision=2},
      width=0.51\textwidth, 
      xlabel=Verformungsweg $x$ {[mm]}, 
      ylabel=Kraft $F$ {[N]},
      legend style={ 
        font=\scriptsize, 
        cells={anchor=west}, 
        legend pos=south west 
      }, 
      cycle list name=color list, 
      table/col sep=tab, 
      table/trim cells=true, 
      smooth, 
    } 
}
\pgfplotscreateplotcyclelist{color list}{myColor03,myColor00,myColor01,myColor02} 
\centering 
\subfloat[][Auskragung $A$~=~200~mm]{ 
    \begin{tikzpicture}[trim axis left] 
    \begin{axis}[ 
      myaxis,
      xtick={-0.04,-0.02,0,0.02,0.04}, 
      y label style={at={(axis description cs:-0.095,.5)},anchor=south}, 
      yticklabel pos=left, 
      xmin=-0.053, xmax=0.06, 
      ymin=-95,ymax=95, 
    ] 
    \draw[very thin](current axis.left of origin)--(current axis.right of origin); 
    \draw[very thin](current axis.below origin)--(current axis.above origin); 
    \addplot+[densely dashdotdotted] table [x index=7,y index=6] {bilder/statischXY200mm.csv}; 
    \addplot table [x index=1,y index=0] {bilder/statischXY200mm.csv}; 
    \addplot table [x index=3,y index=2] {bilder/statischXY200mm.csv}; 
    \addplot table [x index=5,y index=4] {bilder/statischXY200mm.csv}; 
    \addlegendentry{Mittelwert} 
    \end{axis} 
    \end{tikzpicture} 
} 
\subfloat[][Auskragung $A$~=~295~mm]{ 
    \begin{tikzpicture}[trim axis right] 
    \begin{axis}[ 
      myaxis, 
      xtick={-0.05,0,0.05}, 
      yticklabel pos=right, 
      y label style={at={(axis description cs:1.195,.5)},anchor=south}, 
      xmin=-0.096, xmax=0.13, 
      ymin=-80,ymax=80, 
    ] 

    \draw[very thin](current axis.left of origin)--(current axis.right of origin); 
    \draw[very thin](current axis.below origin)--(current axis.above origin); 
    \addplot+[densely dashdotdotted] table [x index=7,y index=6] {bilder/statischXY295mm.csv}; 
    \addplot table [x index=1,y index=0] {bilder/statischXY295mm.csv}; 
    \addplot table [x index=3,y index=2] {bilder/statischXY295mm.csv}; 
    \addplot table [x index=5,y index=4] {bilder/statischXY295mm.csv}; 

    \addlegendentry{Mittelwert} 
    \end{axis} 
    \end{tikzpicture} 
} 
\caption{Lineare Steifigkeitsmessung aller Positionen in $\pm~xy$-Richtung} 
\label{fig:statischXY} 
\end{figure} 
\end{document}
  • thanks for pretty-printing my code! everything works good now. – goodstuff Nov 24 '14 at 16:24
4

I can't compile that thing so I'm summoning my crystal ball and guess that you need to add

scaled x ticks=false

option to the first plot axis options.

pgfplots loads TikZ. TikZ loads pgfkeys and xcolor. So you only need the first for those four packages.

  • @goodstuff: This is my guess, too. But in order to get your problem solved properly you should really shorten your code to a MWE. Replace your custom colors with one of the provided cycle lists and double check your csv-files. They seem to be OK in Excel or LibreOffice (on my Mac). However, I have an empty line in the middle when opening them using a text editor (TextWrangler). Additionally, you should think about rearranging the indentation of your code to equal levels. – albert Nov 23 '14 at 21:21
  • The extra line is necessary due to the "smooth" option. thanks though ;) – goodstuff Nov 23 '14 at 21:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.