Ich möchte gerne einen Plot mit zwei y-Achsen zeichnen. Das funktioniert auch soweit. Leider gibt es beim zweiten Datensatz 0-Werte, sodass er mir die x-Achsenbeschriftung (2008, 2009, 2010) weglässt.

Wie kann ich erzwingen, dass die x-Achsenbeschriftung angezeigt wird, auch wenn die Werte 0 sind.

Open in Online-Editor
\documentclass{standalone}
\usepackage{luatextra}
\usepackage{fontspec}
  \setmainfont{Arial}
  \setsansfont{Arial}
  \setmonofont{Consolas}
  \defaultfontfeatures{Ligatures=TeX}
\usepackage{pgfplots}

\pgfplotsset{compat=newest}
\usepackage{pgfplotstable}
\usepgfplotslibrary{dateplot}
\usetikzlibrary{shapes,arrows, patterns}

\begin{document}
\begin{tikzpicture}
\begin{semilogyaxis}[
    ybar,
    log origin=infty,
    width = \linewidth,
    ymin=1E-12,
    ymax=1E-5,
    ylabel = {ICumCDP latenter Fehler},
    axis y line*=left,
    symbolic x coords={2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014},
    xtick=data
]

\addplot+[ybar, blue, bar shift=-0.2cm] coordinates {
  (2006, 2.59e-10)
  (2007, 1.91e-07)
  (2008, 0.00e+00)
  (2009, 0.00e+00)
  (2010, 0.00e+00)
  (2011, 0.00e+00)
  (2012, 3.45e-08)
  (2013, 3.36e-08)
  (2014, 2.35e-06)
};

\end{semilogyaxis}

%%%%% Anteile Latenter Fehler an ICumCDP %%%%%
\begin{axis}[
    ybar,
    width = \linewidth,
    ymin=0,
    ymax=100,
    ylabel = {Anteil latenter Fehler an ICumCDP (\%)},
    axis y line*=right,
    symbolic x coords={2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014},
    xtick=data,
    hide x axis
]

\addplot+[ybar, red, bar shift=0.2cm] coordinates {
  (2006, 0.27)
  (2007, 59.50)
  (2008, 0.00)
  (2009, 0.00)
  (2010, 0.00)
  (2011, 0.00)
  (2012, 2.20)
  (2013, 24.71)
  (2014, 53.05)
};

\end{axis}

\end{tikzpicture}
\end{document}

gefragt 02 Jun '15, 14:21

dzaic's gravatar image

dzaic
631104853
Akzeptiert-Rate: 42%

bearbeitet 02 Jun '15, 14:23

Lass xtick=data weg.

(02 Jun '15, 15:16) esdd

Super! Funktioniert einwandfrei.

(02 Jun '15, 15:50) dzaic

Die Lösung ist: Weglassen von xtick=data

Open in Online-Editor
\documentclass{standalone}
\usepackage{luatextra}
\usepackage{fontspec}
  \setmainfont{Arial}
  \setsansfont{Arial}
  \setmonofont{Consolas}
  \defaultfontfeatures{Ligatures=TeX}
\usepackage{pgfplots}

\pgfplotsset{compat=newest}
\usepackage{pgfplotstable}
\usepgfplotslibrary{dateplot}
\usetikzlibrary{shapes,arrows, patterns}

\begin{document}
\begin{tikzpicture}
\begin{semilogyaxis}[
    ybar,
    log origin=infty,
    width = \linewidth,
    ymin=1E-12,
    ymax=1E-5,
    ylabel = {ICumCDP latenter Fehler},
    axis y line*=left,
    symbolic x coords={2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014}
]

\addplot+[ybar, blue, bar shift=-0.2cm] coordinates {
  (2006, 2.59e-10)
  (2007, 1.91e-07)
  (2008, 0.00e+00)
  (2009, 0.00e+00)
  (2010, 0.00e+00)
  (2011, 0.00e+00)
  (2012, 3.45e-08)
  (2013, 3.36e-08)
  (2014, 2.35e-06)
};

\end{semilogyaxis}

%%%%% Anteile Latenter Fehler an ICumCDP %%%%%
\begin{axis}[
    ybar,
    width = \linewidth,
    ymin=0,
    ymax=100,
    ylabel = {Anteil latenter Fehler an ICumCDP (\%)},
    axis y line*=right,
    symbolic x coords={2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014},
    hide x axis
]

\addplot+[ybar, red, bar shift=0.2cm] coordinates {
  (2006, 0.27)
  (2007, 59.50)
  (2008, 0.00)
  (2009, 0.00)
  (2010, 0.00)
  (2011, 0.00)
  (2012, 2.20)
  (2013, 24.71)
  (2014, 53.05)
};

\end{axis}

\end{tikzpicture}
\end{document}
Permanenter link

beantwortet 02 Jun '15, 15:51

dzaic's gravatar image

dzaic
631104853
Akzeptiert-Rate: 42%

Deine Antwort
Vorschau umschalten

Folgen dieser Frage

Per E-Mail:

Wenn sie sich anmelden, kommen Sie für alle Updates hier in Frage

Per RSS:

Antworten

Antworten und Kommentare

Markdown-Grundlagen

  • *kursiv* oder _kursiv_
  • **Fett** oder __Fett__
  • Link:[Text](http://url.com/ "Titel")
  • Bild?![alt Text](/path/img.jpg "Titel")
  • nummerierte Liste: 1. Foo 2. Bar
  • zum Hinzufügen ein Zeilenumbruchs fügen Sie einfach zwei Leerzeichen an die Stelle an der die neue Linie sein soll.
  • grundlegende HTML-Tags werden ebenfalls unterstützt

Frage-Themen:

×296

gestellte Frage: 02 Jun '15, 14:21

Frage wurde gesehen: 6,432 Mal

zuletzt geändert: 02 Jun '15, 15:51