Beschriftung einer Tikz-Grafik -- unterhalb der X-Achse Thema ist als GELÖST markiert

Tabellen und Grafiken erstellen und anordnen


brisi
Forum-Anfänger
Forum-Anfänger
Beiträge: 24
Registriert: Di 7. Nov 2017, 09:40

Beschriftung einer Tikz-Grafik -- unterhalb der X-Achse

Beitrag von brisi »

Hallo Zusammen,

ich würde gerne bei diesem xy-Diagramm die Bezeichnungen (G1-Phase, S-Phase, G2-Phase, Mitose, Cytokinese) unterhalb der X-Achse anzeigen.

\documentclass{article}
\usepackage[ngerman]{babel}


\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepackage{tikz}
\usetikzlibrary{arrows,calc}
\tikzset{
%Define standard arrow tip
=stealth',
%Define style for different line styles
help lines/.style={dashed, thick},
axis/.style={<->},
important line/.style={thick},
connection/.style={thick, dotted},
}

\begin{document}

\begin{tikzpicture}
  \begin{axis}[
    xmin = 0, xmax = 5,
    ymin = 0, ymax = 15,
    xtick distance = 1.0,
    ytick distance = 2.0,
    xticklabels={,,},
xlabel={Phasen des Zellzyklus},
ylabel={DNA-Gehalt der Zelle / [pg]},
y label style={at={(axis description cs:-0.05,0.5)},rotate=0,anchor=south},
grid = both,
    minor tick num = 1,
    major grid style = {lightgray},
    minor grid style = {lightgray!25},
    width = \textwidth,
    height = 0.6\textwidth,
]
\node[above] at (0.5,0) {$G_1$-Phase};
\node[above] at (1.5,0) {$S$-Phase};
\node[above] at (2.5,0) {$G_2$-Phase};
\node[above] at (3.5,0) {Mitose};
\node[above] at (4.5,0) {Cytokinese};
\end{axis}
\end{tikzpicture}

\end{document}

Vielen herzlichen Dank für die Hilfe!


Stamm-Gast

Re: Beschriftung einer Tikz-Grafik -- unterhalb der X-Achse

Beitrag von Stamm-Gast »

Dafür müssen die clip-Funktion der Achsen-Umgebung deaktiviert und vorhandene 'x tick label' versteckt werden, um ausreichend Platz für die Bezeichnungen zu gewahrleisten. Die Knoten mit den Bezeichnungen werden dann entsprechend gesetzt und ausgerichtet.

\documentclass[11pt,a4paper,ngerman]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}

\usepackage{pgfplots}
\pgfplotsset{
  compat=newest,
  axis/.style={<->},
  xlabel near ticks,
  ylabel near ticks
}

\usetikzlibrary{arrows,calc}
\tikzset{
  >=stealth',
  help lines/.style={dashed,thick},
  important line/.style={thick},
  connection/.style={thick,dotted},
}

\usepackage{lmodern}
\usepackage[babel]{microtype}

\begin{document}
  \begin{tikzpicture}
    \begin{axis}[
      clip=false,
      xmin=0,
      xmax=5,
      ymin=0,ymax=15,
      xtick distance=1.0,
      ytick distance=2.0,
      x tick label style={color=white},% Existierende 'Tick label' verstecken
      xlabel={Phasen des Zellzyklus},
      ylabel={DNA"=Gehalt der Zelle / pg},
      grid=both,
      minor tick num=1,
      major grid style={lightgray},
      minor grid style={lightgray!25},
      width=\textwidth,
      height=0.6\textwidth,
    ]
      \node[above,anchor=base] at (0.5,-1) {$G_1$"=Phase};
      \node[above,anchor=base] at (1.5,-1) {$S$"=Phase};
      \node[above,anchor=base] at (2.5,-1) {$G_2$"=Phase};
      \node[above,anchor=base] at (3.5,-1) {Mitose};
      \node[above,anchor=base] at (4.5,-1) {Cytokinese};
   \end{axis}
 \end{tikzpicture}
\end{document}

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

Re: Beschriftung einer Tikz-Grafik -- unterhalb der X-Achse

Beitrag von Bartman »

Ein Beispiel mit extra x ticks:

\documentclass{standalone}
\usepackage{pgfplots}

\pgfplotsset{compat=1.17}

\begin{document}
\begin{tikzpicture}
  \begin{axis}[
    xmin = 0, xmax = 5,
    ymin = 0, ymax = 15,
    xtick distance = 1.0,
    ytick distance = 2.0,
    xticklabel=\empty,
    extra x ticks={0.5,...,4.5},
    extra x tick labels={$G_1$-Phase,$S$-Phase,$G_2$-Phase,Mitose,Cytokinese},
    extra x tick style={
        major grid style = {draw=none}
    },
    xlabel={Phasen des Zellzyklus},
    ylabel={DNA-Gehalt der Zelle / [pg]},
    grid = both,
    minor tick num = 1,
    major grid style = {lightgray},
    minor grid style = {lightgray!25},
    width = \textwidth,
    height = 0.6\textwidth
]
\end{axis}
\end{tikzpicture}
\end{document}

brisi
Forum-Anfänger
Forum-Anfänger
Beiträge: 24
Registriert: Di 7. Nov 2017, 09:40

Re: Beschriftung einer Tikz-Grafik -- unterhalb der X-Achse

Beitrag von brisi »

Vielen herzlichen Dank für beide Lösungen -- genau wonach ich gesucht habe!!


Antworten