Legende von tikzpicture ist leider auf dem Seitenrand

Layout von Seiten, Rändern, Fusszeilen, usw, modifizieren


Neo
Forum-Fortgeschrittener
Forum-Fortgeschrittener
Beiträge: 61
Registriert: Mo 21. Dez 2020, 20:36

Legende von tikzpicture ist leider auf dem Seitenrand

Beitrag von Neo »

Ich möchte gerne, dass sich die eingestellte Breite nicht nur auf die tikzpicture, sondern auch auf die Legende bezieht.
\documentclass[DIV = 20]{scrartcl}
\usepackage{pgfplots , showframe}

\begin{document}
\begin{tikzpicture}
	\begin{axis}[%
	width = \textwidth,%
	height = 5.5cm,%
	legend style = {legend pos = outer north east}%
	]
	\addplot[color=red,mark=x] coordinates{%
		(2,-2)
		(8,-7)
	};
	\addlegendentry{Legende}
    \end{axis}
\end{tikzpicture}
\end{document}

Neo
Forum-Fortgeschrittener
Forum-Fortgeschrittener
Beiträge: 61
Registriert: Mo 21. Dez 2020, 20:36

Re: Legende von tikzpicture ist leider auf dem Seitenrand

Beitrag von Neo »

Habe es inzwischen selbst gelöst bekommen. Hier das Ergebnis:
Allerdings ist das Ergebnis dann gestaucht. Hat jemand vielleicht eine Lösung?
\documentclass[DIV = 20]{scrartcl}
\usepackage{pgfplots , showframe}

\begin{document}
\resizebox{\columnwidth}{5cm}{%
\begin{tikzpicture}
	\begin{axis}[%
	%height = 5.5cm,%
	%width = \textwidth
	legend style = {legend pos = outer north east}%
	]
	\addplot[color=red,mark=x] coordinates{%
		(2,-2)
		(8,-7)
	};
	\addlegendentry{Legende}
    \end{axis}
\end{tikzpicture}
}
\end{document}

Abc

Beitrag von Abc »

Die Beschreibung von \resizebox in graphicx hat noch das Ausrufezeichen anzubieten.

Neo
Forum-Fortgeschrittener
Forum-Fortgeschrittener
Beiträge: 61
Registriert: Mo 21. Dez 2020, 20:36

Re:

Beitrag von Neo »

Abc hat geschrieben:
Mi 8. Feb 2023, 16:51
Die Beschreibung von \resizebox in graphicx hat noch das Ausrufezeichen anzubieten.
Ich weiß. Die Höhe von 5 cm ist von mir jedoch bewusst gewählt und auch so gewollt.

Antworten