Grafik zentrieren

Tabellen und Grafiken erstellen und anordnen


Patrick1990
Forum-Century
Forum-Century
Beiträge: 208
Registriert: Mo 18. Feb 2013, 07:56
Wohnort: Ilmenau

Grafik zentrieren

Beitrag von Patrick1990 »

Hallo,

ich habe eine Grafik, welche ich gern horizontal zentriert haben möchte.
Leider verstehe ich nicht so richtig, wieso die Grafik extrem verschoben ist.
Ich habe sie nun manuell mit \vspace und \hspace verschoben, jedoch muss es doch sicherlich noch einen eleganteren Weg geben.

Könnt ihr mir helfen?

Hier das Beispiel:
\documentclass{scrreprt} 
\usepackage{tikz}
\usepackage{float}
\usepackage{pgfplots}
\pgfplotsset{compat=newest} 
\usepgfplotslibrary{fillbetween} 
\usepackage{nicefrac}



\begin{document} 
\begin{figure}
\centering
\vspace{-40.5cm}
\hspace*{9.25cm}
\begin{tikzpicture}[scale=3,>=latex] 
\begin{axis}[ 
    trig format plots=rad, 
    axis equal, 
%    ymin=0, ymax = 195, 
    xmin=0, xmax=200, 
    hide axis,
    x label style={at={(axis description cs:0.5,-0.5)},anchor=north},
    y label style={at={(axis description cs:-0.1,0.5)},rotate=90,anchor=south}
] 
\draw[black,fill=black] (60.46181719,163.8889268) circle [radius=1.5]; %Pe1
\draw[black,fill=black] (66,159.25) circle [radius=1.5]; %Pe2
\draw[black, fill=black] (70.6558,170.578) circle [black, radius=1.5]; %S
\addplot [domain=0 : 0.125*pi*0.9, samples=200, black, name path = top, line width=1.5pt] 
  ({sin(x)*(179-0.8*(1/(cos(4*x))-1))}, {cos(x)*(179-0.8*(1/(cos(4*x))-1))}); 
%Tangente 
\addplot[black, domain=50:90] {163.889 - 1.52393*(-60.4618 + x)}; 
%Orthogonale 
\addplot[black, domain=50:90] {163.889 - 0.656199*(60.4618 - x)}; 
%Gerade 22.5° 
\addplot[black, domain=0:80, name path = right2] {tan(pi/2-0.125*pi)*x}; 
\addplot [domain=0:2*pi, samples=50, red] ({70.6558+12.1928*cos(x)}, 
  {170.578+12.1928*sin(x)}); 
\addplot [domain=1.18*pi:1.38*pi, samples=50, blue,  name path = top2, line width=1.5pt] ({70.6558+12.1928*cos(x)}, 
  {170.578+12.1928*sin(x)}); 
\path[name path = left, draw] (0,0) -- (0,179); 
\path[name path = right, draw] (0,0) -- (60.46181719,163.8889268); 
%\draw[->] (30,100) arc (80:30:35); 
%Beschriftungen
\node[anchor=east] at (60.46181719,163.8889268) {$P_{e,1}$};
\node[anchor=north west] at (66,159.25) {$P_{e,2}$};
\node[anchor=south east] at (70.6558,170.578) {$S$};
\draw[->] (0,100) arc (90:67.5:100);
\node[anchor=center] at (78.75:90) {$\nicefrac{\pi}{2p}$};
%
\draw[->] (0,40) arc (90:70:40);
\node[anchor=center] at (80:30) {$\varphi$};
%
\addplot [domain=1.18*pi:1.38*pi, samples=50, black] ({70.6558+10*cos(x)}, {170.578+10*sin(x)});
\draw[-] (66,165) -- (95,165);
\node[anchor=west] at (95,165) {$\beta$};
%
\draw[-] (20,178) -- (20,185);
\node[anchor=south] at (20,185) {$\vec r(\varphi)$};
%
\draw[-] (85,180) -- (95,180);
\node[anchor=west] at (95,180) {$o(x)$};
%
\draw[-] (76,140) -- (95,140);
\node[anchor=west] at (95,140) {$t(x)$};
%
\draw[-] (41.5,100) -- (95,100);
\node[anchor=west] at (95,100) {$b(x)$};
%Füllungen
\addplot[gray!30] fill between[of=top and right]; 
\addplot[blue!30] fill between[of=right2 and top2]; 
%Koordinatenachsen
\draw[->] (0,0) -- (0,200);
\node[anchor=east] at (0,200) {$y$};
\draw[->] (0,0) -- (200,0);
\node[anchor=north] at (200,0) {$x$};
%Kreis
\addplot [domain=0 : 0.5*pi*1, samples=200, gray,dashed] 
  ({179*sin(x)}, {179*cos(x)}); 
\end{axis} 
\end{tikzpicture}
\vspace{4cm}
\caption{Test}
\end{figure}

\end{document}

Benutzeravatar
u_fischer
Forum-Meister
Forum-Meister
Beiträge: 4267
Registriert: Do 22. Nov 2012, 11:09
Kontaktdaten:

Beitrag von u_fischer »

Du solltest die axis und nicht die ganze tikzpicture skalieren.

\begin{axis}[scale=3,

Patrick1990
Forum-Century
Forum-Century
Beiträge: 208
Registriert: Mo 18. Feb 2013, 07:56
Wohnort: Ilmenau

Beitrag von Patrick1990 »

Vielen Dank.

Antworten