Ich möchte gerne nur die Jahreszahlen in der x-Achse ausgeben lassen.

Open in Online-Editor
\documentclass{standalone}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{dateplot}
\usetikzlibrary{shapes,arrows, patterns}

\begin{document}
\begin{tikzpicture}
\begin{semilogyaxis}[
    width = \textwidth,
    axis on top = true,
    xmin = 2006-01-01,
    xmax = 2014-12-31,
    xtick = {2006-01-01, 2007-01-01, 2008-01-01, 2009-01-01, 2010-01-01, 2011-01-01, 2012-01-01, 2013-01-01, 2014-01-01},
    xticklabel style ={/pgf/number format/1000 sep=},
    ymin = 1.0e-13,
    ymax = 1,
    ylabel = {ICumCDP},
    ymajorgrids,
    date coordinates in = x,
    date ZERO = 2006-01-01
]
\addplot[blue, only marks, mark size = 0.5] coordinates {
  (2006-05-07, 5.25e-09)
  (2007-03-08, 3.52e-08)
  (2008-01-31, 1.38e-09)
  (2009-10-18, 3.32e-09)
  (2010-05-17, 1.86e-09)
  (2011-03-17, 4.80e-10)
  (2012-04-15, 5.18e-09)
  (2013-04-26, 1.53e-11)
  (2014-03-06, 3.07e-10)
};
\fill [red!25] (axis cs:2006-01-01,1E-6) rectangle (axis cs:2014-12-31,1E-4);
\fill [red!50] (axis cs:2006-01-01,1E-4) rectangle (axis cs:2014-12-31,1E-2);
\fill [red] (axis cs:2006-01-01,1E-2) rectangle (axis cs:2014-12-31,1);

\end{semilogyaxis}
\end{tikzpicture}
\end{document}

gefragt 03 Jun '15, 11:26

dzaic's gravatar image

dzaic
631104853
Akzeptiert-Rate: 42%

bearbeitet 10 Jun '15, 15:55


Setze die Option xticklabel als

Open in Online-Editor
xticklabel=\year

nach der Option

Open in Online-Editor
date coordinates in = x

alt text

Code:

Open in Online-Editor
\documentclass[margin=5pt]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{dateplot}
\pgfplotsset{compat=newest}

\begin{document}
\begin{tikzpicture}
\begin{semilogyaxis}[
    width = \textwidth,
    axis on top = true,
    date coordinates in = x,
    date ZERO = 2006-01-01,
    xmin = 2006-01-01,
    xmax = 2014-12-31,
    xtick = {2006-01-01, 2007-01-01, 2008-01-01, 2009-01-01, 2010-01-01, 2011-01-01, 2012-01-01, 2013-01-01, 2014-01-01},
    xticklabel=\year,
    ymin = 1.0e-13,
    ymax = 1,
    ylabel = {ICumCDP},
    ymajorgrids,
]
\addplot[blue, only marks, mark size = 0.5] coordinates {
  (2006-05-07, 5.25e-09)
  (2007-03-08, 3.52e-08)
  (2008-01-31, 1.38e-09)
  (2009-10-18, 3.32e-09)
  (2010-05-17, 1.86e-09)
  (2011-03-17, 4.80e-10)
  (2012-04-15, 5.18e-09)
  (2013-04-26, 1.53e-11)
  (2014-03-06, 3.07e-10)
};
\fill [red!25] (axis cs:2006-01-01,1E-6) rectangle (axis cs:2014-12-31,1E-4);
\fill [red!50] (axis cs:2006-01-01,1E-4) rectangle (axis cs:2014-12-31,1E-2);
\fill [red] (axis cs:2006-01-01,1E-2) rectangle (axis cs:2014-12-31,1);
\end{semilogyaxis}
\end{tikzpicture}
\end{document}
Permanenter link

beantwortet 03 Jun '15, 14:27

esdd's gravatar image

esdd
17.7k254256
Akzeptiert-Rate: 62%

Interessant, dass es hier offenkundig bei den Optionen auch auf die Reihenfolge ankommt. Merci für deine kompetente Hilfe!

(10 Jun '15, 15:58) dzaic
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: 03 Jun '15, 11:26

Frage wurde gesehen: 6,927 Mal

zuletzt geändert: 10 Jun '15, 15:58