pgfplots xlabel fehler (automatische skalierung ausschalten)

Tabellen und Grafiken erstellen und anordnen


goodstuff
Forum-Newbie
Forum-Newbie
Beiträge: 6
Registriert: So 23. Nov 2014, 18:24

pgfplots xlabel fehler (automatische skalierung ausschalten)

Beitrag von goodstuff »

Folgendes Problem:
Ich musste die Beschriftung der x-Achse wegen Schönheitsfehlern manuell einstellen. Da Latex mir die Skalierung automatisch logarithmisch umgestellt hat. Soweit so gut, alles zurechtgestutzt.
Allerdings taucht bei dem Plot trotzdem ein "10^2" in der Nähe meiner Caption auf (siehe plot.png). Ich hab so einen Fehler nicht googlen können und bitte deswegen um Hilfe.
Falls nötig, hänge ich auch meine Daten als .txt an. Eingebunden sind sie allerdings als .csv

Allerdings kriege ich es nicht hin, Dateien anzuhängen :(

Ich benütze texlive und TexnicCenter 2.02 stable (64bit)

Minimalbeispiel:
\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}
Ich hoffe mein Minimalbeispiel passt. (FirstTimer:)
Über schnelle Hilfe wäre ich sehr dankbar.
[img]Desktop/plot.png[/img]
Zuletzt geändert von goodstuff am So 23. Nov 2014, 22:48, insgesamt 2-mal geändert.

goodstuff
Forum-Newbie
Forum-Newbie
Beiträge: 6
Registriert: So 23. Nov 2014, 18:24

Beitrag von goodstuff »

irgendwie kann ich keine dateien anhängen...
dann halt so:

https://www.dropbox.com/sh/53j803zmh9mp ... GZAYa?dl=0

goodstuff
Forum-Newbie
Forum-Newbie
Beiträge: 6
Registriert: So 23. Nov 2014, 18:24

Beitrag von goodstuff »

sorry für das komplizierte minimalbeispiel.

fehler behoben durch den befehl:

scaled x ticks=false,

danke trotzdem

Benutzeravatar
Johannes_B
Moderator
Moderator
Beiträge: 5079
Registriert: Do 1. Nov 2012, 14:55
Kontaktdaten:

Beitrag von Johannes_B »

Das ist ein Crosspost zu TeX.SX
TeXwelt - Fragen und Antworten Schaut vorbei und stellt Fragen.
LaTeX-Vorlagen?

Der Weg zum Ziel: Ruhe bewahren und durchatmen, Beiträge und unterstützende Links aufmerksam lesen, Lösungsansätze verstehen und ggf. nachfragen.

esdd
Forum-Meister
Forum-Meister
Beiträge: 2561
Registriert: So 7. Feb 2010, 16:36

Beitrag von esdd »

Nimm
    scaled x ticks=false,
    xticklabel style={/pgf/number format/.cd,fixed,precision=2},
damit die xticklabel automatisch wie gewünscht formatiert werden.

Warum definierst Du in dem Beispiel mehrere cycle list, wenn diese durch die forget plot gar nicht wirksam werden können?

Vorschlag:
\documentclass{scrreprt} 

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

\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, 
   } 
} 

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


\pgfplotscreateplotcyclelist{color list}{myColor03,myColor00,myColor01,myColor02} 

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

\begin{document} 
\begin{figure} 
\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}
Gruß
Elke

goodstuff
Forum-Newbie
Forum-Newbie
Beiträge: 6
Registriert: So 23. Nov 2014, 18:24

Beitrag von goodstuff »

Johannes_B hat geschrieben:Das ist ein Crosspost zu TeX.SX
ist das nicht erlaubt? habe die antwort möglichst schnell gebraucht.

esdd
Forum-Meister
Forum-Meister
Beiträge: 2561
Registriert: So 7. Feb 2010, 16:36

Beitrag von esdd »

Nein, das ist hier eigentlich nicht erlaubt. Und wenn man es trotzdem tut, dann sollte man wenigstens den anderen Thread hier selbst verlinken.

Benutzeravatar
Johannes_B
Moderator
Moderator
Beiträge: 5079
Registriert: Do 1. Nov 2012, 14:55
Kontaktdaten:

Beitrag von Johannes_B »

Für mich persönlich ist das eine Sache der Fairness. Gimme Pizza.

Obwohl hier offiziell verboten, habe ich persönlich gegen markierte Crossposts nichts.
TeXwelt - Fragen und Antworten Schaut vorbei und stellt Fragen.
LaTeX-Vorlagen?

Der Weg zum Ziel: Ruhe bewahren und durchatmen, Beiträge und unterstützende Links aufmerksam lesen, Lösungsansätze verstehen und ggf. nachfragen.

goodstuff
Forum-Newbie
Forum-Newbie
Beiträge: 6
Registriert: So 23. Nov 2014, 18:24

Beitrag von goodstuff »

Johannes_B hat geschrieben:Für mich persönlich ist das eine Sache der Fairness. Gimme Pizza.

Obwohl hier offiziell verboten, habe ich persönlich gegen markierte Crossposts nichts.
^^ alles klar sorry, merk ich mir. bin nicht nur ein forum newbie sondern auch ein latex newbie.

...und ich dachte ich mache nur fehler in den codes -.-

goodstuff
Forum-Newbie
Forum-Newbie
Beiträge: 6
Registriert: So 23. Nov 2014, 18:24

Beitrag von goodstuff »

esdd hat geschrieben:Nimm
    scaled x ticks=false,
    xticklabel style={/pgf/number format/.cd,fixed,precision=2},
damit die xticklabel automatisch wie gewünscht formatiert werden.

Warum definierst Du in dem Beispiel mehrere cycle list, wenn diese durch die forget plot gar nicht wirksam werden können?

Gruß
Elke
dein "xticklabel style" spuckt mir fehler aus. aber ist ok, es geht ja mit meiner komplizierten version.

die "forget plot" einstellung habe ich vorgenommen bevor ich auf die "axis x line=middle" funktion gestoßen bin. danke für die hilfe!!!

Antworten