Achse mit 0 beginnend ohne weitere Skalierungsänderung

Tabellen und Grafiken erstellen und anordnen


Darcy
Forum-Newbie
Forum-Newbie
Beiträge: 9
Registriert: Mo 15. Mai 2017, 14:22

Achse mit 0 beginnend ohne weitere Skalierungsänderung

Beitrag von Darcy »

Hallo zusammen,

ich habe das Problem, dass mein Prof gerne möchte, dass die Skalierung aller Diagramme bei 0 anfängt. Aber das würde dazu führen, dass man nicht mehr viel erkennen kann. Deshalb hätte ich gerne, dass die 0 kommt, dann ein Doppelstrich oder Ähnliches und die Achse dann bei einer beliebigen Zahl (in dem Beispiel 0,12 und 0,15) weiter geht, ohne dass sich die restliche Skalierung sonderlich doll verschiebt. Ich hab es bisher mit ytick={0, 0.12,...,0.18} versucht, aber das bringt nicht wirklich das passende Ergebnis und im Manual kann ich dazu auch nichts finden.

Kann mir dabei jemand helfen?

Danke und Grüße
Darcy
\documentclass[a4paper,oneside,10pt,captions=nooneline]{scrreprt} 
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
 
\usepackage{pgfplots}

\usetikzlibrary{matrix} 

\pgfplotsset{compat=newest}

\begin{document}
       
\begin{figure}[htb]
\centering
   \begin{tikzpicture}
     \begin{axis}[
         xlabel={{Zeit\,/\,min}},
         ylabel={{Spezifische Diluatleitf{\"a}higkeit\,/\,$\mathrm{\mu}$S\,cm\textsuperscript{-1}}},
         enlarge x limits=0.01,
         scale only axis,
         xmax=330,
         ymin=0.12,
         ymax=0.18,
         axis y line=left]
          \addplot[gray, very thick, mark=triangle*] coordinates{
         (0, 0.12)
         (150, 0.15)
         (330, 0.16)};
         \label{GBkappa}
         \addplot [black, very thick] coordinates{
         (0, 0.13)
         (150, 0.14)
         (330, 0.15)};
         \label{MBkappa}
      \end{axis}
         
       \begin{axis}
        [xlabel={{Zeit\,/\,min}},
         ylabel={{Strom\,/\,A}},
         enlarge x limits=0.01,
         xmax=330,
         ymin=0.15,ymax=0.55,
         scale only axis,
         axis y line=right,
         axis x line=none]
         \addplot [only marks, gray, mark=triangle*] coordinates{
         (0, 0.15)
         (150, 0.35)
         (330, 0.54)};
         \label{iGB}
         \addplot [only marks, mark=x] coordinates{
         (0, 0.17)
         (150, 0.25)
         (330, 0.35)};
         \label{iMB}
         \end{axis}
       \matrix[ 
            matrix of nodes, 
            draw, 
            anchor=north, 
            column 1/.style={nodes={anchor=center}}, 
            column 2/.style={nodes={anchor=west}} 
            ] at([yshift=-3.5em]current axis.south) 
            { 
            \ref{MBkappa}& MB Harz Leitf{\"a}higkeit\\ 
            \ref{GBkappa}& GB Harz Leitf{\"a}higkeit\\ 
            \ref{iMB}& MB Harz Stromstärke\\ 
            \ref{iGB}& GB Harz Stromstärke\\
            };
      \end{tikzpicture}
      \caption{Vergleich MB mit GB Harz Modul (Diluatleitfähgikeit und Stromstärke)}
      \label{fig:GB vs. MB}
   \end{figure}
   
   \end{document}
 

Bartman
Forum-Meister
Forum-Meister
Beiträge: 2456
Registriert: Do 16. Jul 2009, 21:41
Wohnort: Hessische Provinz

Beitrag von Bartman »

Besonders die linke Beschriftung Deiner y-Achse ist viel zu umständlich. Das lässt sich mit dem Paket siunitx beheben.

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

Beitrag von esdd »

Näherungsweise lässt sich das mit einer geeigneten Kombination von axis y discontinuity=parallel, ymin und ytickmin erreichen.
\documentclass[a4paper,oneside,10pt,captions=nooneline]{scrreprt} 
\usepackage[T1]{fontenc} 
\usepackage[utf8]{inputenc} 
\usepackage[ngerman]{babel} 

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

\begin{document} 
\begin{figure}[htb] 
\centering 
   \begin{tikzpicture} 
     \begin{axis}[ 
         xlabel={{Zeit\,/\,min}}, 
         ylabel={{Spezifische Diluatleitfähigkeit\,/\,$\mathrm{\mu}$S\,cm\textsuperscript{-1}}}, 
         enlarge x limits=0.01, 
         scale only axis, 
         xmax=330,
         axis y discontinuity=parallel,
         ytickmin=.12,
         ymin=0.11, 
         ymax=0.18, 
         axis y line=left] 
          \addplot[gray, very thick, mark=triangle*] coordinates{ 
         (0, 0.12) 
         (150, 0.15) 
         (330, 0.16)}; 
         \label{GBkappa} 
         \addplot [black, very thick] coordinates{ 
         (0, 0.13) 
         (150, 0.14) 
         (330, 0.15)}; 
         \label{MBkappa} 
      \end{axis} 
          
       \begin{axis} 
        [xlabel={{Zeit\,/\,min}}, 
         ylabel={{Strom\,/\,A}}, 
         enlarge x limits=0.01, 
         xmax=330, 
         axis y discontinuity=parallel,
         ytickmin=.2,
         ymin=0.12,ymax=0.55, 
         scale only axis, 
         axis y line=right, 
         axis x line=none] 
         \addplot [only marks, gray, mark=triangle*] coordinates{ 
         (0, 0.15) 
         (150, 0.35) 
         (330, 0.54)}; 
         \label{iGB} 
         \addplot [only marks, mark=x] coordinates{ 
         (0, 0.17) 
         (150, 0.25) 
         (330, 0.35)}; 
         \label{iMB} 
         \end{axis} 
       \matrix[ 
            matrix of nodes, 
            draw, 
            anchor=north, 
            column 1/.style={nodes={anchor=center}}, 
            column 2/.style={nodes={anchor=west}} 
            ] at([yshift=-3.5em]current axis.south) 
            { 
            \ref{MBkappa}& MB Harz Leitfähigkeit\\ 
            \ref{GBkappa}& GB Harz Leitfähigkeit\\ 
            \ref{iMB}& MB Harz Stromstärke\\ 
            \ref{iGB}& GB Harz Stromstärke\\ 
            }; 
      \end{tikzpicture} 
      \caption{Vergleich MB mit GB Harz Modul (Diluatleitfähgikeit und Stromstärke)} 
      \label{fig:GB vs. MB} 
   \end{figure} 
   \end{document}

Darcy
Forum-Newbie
Forum-Newbie
Beiträge: 9
Registriert: Mo 15. Mai 2017, 14:22

Beitrag von Darcy »

Super, danke! :)

Mit dem richtigen Begriff findet man es dann ja auch im Manual... :roll: :)

Antworten