Schnittpunkt y-Achse mit x-Achse definieren

Tabellen und Grafiken erstellen und anordnen


Vaschan
Forum-Fortgeschrittener
Forum-Fortgeschrittener
Beiträge: 68
Registriert: So 8. Mai 2016, 12:35

Schnittpunkt y-Achse mit x-Achse definieren

Beitrag von Vaschan »

Hallo zusammen,

ist es möglich, die Beschriftung der y-Achse auf die rechte Seite und auch außerhalb des "Diagramm-Vierecks" zu setzen?


Vielen Dank!
\documentclass[12pt,titlepage,a4paper]{report}

\usepackage{graphicx}% pdftex als Option grundsätzlich weglassen!
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}% Laut Anleitung immer anzugeben!

\begin{document}

\begin{figure}[tbh]
\begin{tikzpicture}
\begin{axis}[legend style={at={(0.5,1)},anchor=south , legend columns = 3}, ymajorgrids,xmajorgrids]
\addplot coordinates {(0,0) (1,1)};
\addplot coordinates {(0,1) (1,2)};
\addplot coordinates {(0,2) (1,3)};
\node[black,fill=white,above] at (axis cs: 0.5,1){{\Large testtext}};
\legend{c=1.5 ,b=1.6, a=1.4}
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}

Beinschuss
Forum-Meister
Forum-Meister
Beiträge: 808
Registriert: Di 2. Okt 2012, 21:42
Wohnort: NRW

Beitrag von Beinschuss »

Was spricht gegen die Standard-Position links neben der zu beschriftenden Y-Achse?
\begin{axis}[legend style={at={(0.5,1)},anchor=south, legend columns = 3, ylabel=Testnummern}, ymajorgrids,xmajorgrids]
Diese Info erwarte ich als Leser nur dann rechts, wenn mit einer zweiten y-Achse gearbeitet wird, was hier nicht der Fall ist.

Gast

Position der Achsenbeschriftung

Beitrag von Gast »

Ich verstehe nicht, was die Frage mit dem Titel zu tun hat. Jedenfalls kann man die Beschriftung der y-Achse einfach über Option yticklabel pos ändern. Siehe dazu 4.15.2 der aktuellen [d]pgfplots[/d]-Anleitung.
\documentclass[12pt,titlepage,a4paper]{report}

\usepackage{pgfplots}
\pgfplotsset{compat=1.14}% Laut Anleitung immer anzugeben!

\begin{document}

\begin{figure}[tbh]
\begin{tikzpicture}
\begin{axis}[legend style={at={(0.5,1)},anchor=south , legend columns = 3}, ymajorgrids,xmajorgrids,yticklabel pos=right]
\addplot coordinates {(0,0) (1,1)};
\addplot coordinates {(0,1) (1,2)};
\addplot coordinates {(0,2) (1,3)};
\node[black,fill=white,above] at (axis cs: 0.5,1){{\Large testtext}};
\legend{c=1.5 ,b=1.6, a=1.4}
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}

Vaschan
Forum-Fortgeschrittener
Forum-Fortgeschrittener
Beiträge: 68
Registriert: So 8. Mai 2016, 12:35

Beitrag von Vaschan »

Danke für die Hilfe, klappt mit
yticklabel pos=right
Die Notwendigkeit sehe ich darin, dass zwei Diagramme nebeneinander sind
\documentclass[12pt,titlepage,a4paper]{report} 

\usepackage[pdftex]{graphicx} 
\usepackage{pgfplots} 
\usepackage{subfigure} 
\begin{document} 

\begin{figure}[tbh] 
\subfigure[Draufsicht]{\begin{tikzpicture} 
\begin{axis}[ 
legend style={at={(0.5,1)},anchor=south , legend columns = 3}] 
\addplot coordinates {(0,0) (1,1)}; 
\addplot coordinates {(0,1) (1,2)}; 
\addplot coordinates {(0,2) (1,3)}; 
\legend{c,b, a} 
\end{axis} 
\end{tikzpicture}} 
\subfigure[Seitenansicht]{\begin{tikzpicture} 
\begin{axis}[ 
legend style={at={(0.5,1)},anchor=south , legend columns = 3}] 
\addplot coordinates {(0,3) (1,2)}; 
\addplot coordinates {(0,1) (1,0)}; 
\addplot coordinates {(0,2) (1,1)}; 
\legend{c,b, a} 
\end{axis} 
\end{tikzpicture}} 
\caption{test} 
\end{figure} 
\end{document} 

Antworten