tikz graphik

Tabellen und Grafiken erstellen und anordnen


Fabian
Forum-Anfänger
Forum-Anfänger
Beiträge: 26
Registriert: Mi 6. Jun 2012, 08:47

tikz graphik

Beitrag von Fabian »

Hallo

Ich habe eine Graphik mit tikz erstellt: In der Mitte ist ein Kästchen, darum herum vier. Dies funktioniert soweit tiptop, nun ist aber ein fünftes dazugekommen. Wie kann ich diese fünf Kästchen nun so arrangieren, dass sie gleichmässig verteilt um das mittlere Kästchen liegen. Anbei mein Code:

[\documentclass[12pt,leqno,titlepage,a4paper,oneside,listof=flat]{scrartcl}
\usepackage{caption}
\captionsetup{format=plain,justification=justified,font=footnotesize,labelfont=bf,labelsep=colon,}
\usepackage{subcaption}
\usepackage{tikz}
\usetikzlibrary{fit,positioning}

\begin{document}

\begin{figure}[!htbp]
\centering
\begin{tikzpicture}
[node distance = 1cm, auto,font=\footnotesize,
every node/.style={node distance=2cm},
comment/.style={rectangle, inner sep= 5pt, text width=4cm, node distance=0.25cm},
force/.style={rectangle, draw, fill=black!14, inner sep=5pt, text width=3.8cm, text badly centered, minimum height=1.2cm, font=\bfseries\scriptsize}]

\node [force](cs) {Cost Structure};
\node [force, above of=cs](ol){Operating Leverage};
\node [force, left=1cm of cs](cm){BM ratio and Size};
\node [force, right=1cm of cs](p){Accounting Return};
\node [force, below of=cs](risk){Total and Systematic Risk};

\path[->,thick]
(cs) edge node[above]{}(ol)
(cs) edge node[left] {}(cm)
(cs) edge node[below]{}(risk)
(cs) edge node[right]{}(p);

\end{tikzpicture}
\onelinecaptionsfalse
\caption[Research idea]{Research idea\\Figure \ref{fig:researchidea} illustrates the aspects investigated in this dissertation: relation between cost structure and operating leverage, influence of the cost structure on accounting returns, implications of cost structure on total and systematic risk and its relation to BM ratio and size.}
\label{fig:researchidea}
\end{figure}

\end{document}]

Ich gehe davon aus, dass man die Befehle above, below, right und left ändern muss, verstehe aber nicht, wie.

Danke für die Hilfe!

Gruss, Fabian[/code]

esdd
Forum-Meister
Forum-Meister
Beiträge: 2561
Registriert: So 7. Feb 2010, 16:36

Beitrag von esdd »

Hallo,

wenn du 5 Noden um die Node cs verteilen willst, dann muss der Winkel zwischen diesen 72° betragen. Hier sind mal zwei Vorschläge, wie man das realisieren könnte:
\documentclass[12pt,parskip=half-]{scrartcl} 
\usepackage{tikz}
\tikzset{force/.style={draw,fill=black!14,inner sep=5pt,minimum height=1.2cm,%
  text width=3.8cm,text badly centered,font=\bfseries\scriptsize}}
\begin{document} 

Pfeile 2.5\,cm lang:

\begin{tikzpicture} 
\node [force](cs) {Cost Structure};
%
\path (cs.0)--+(0:2.5)node[force,anchor=180](p){Accounting Return};
\path (cs.72) --+(72:2.5)node[force,anchor=252](ol){Operating Leverage}; 
\path (cs.144)--+(144:2.5)node[force,anchor=324](cm){BM ratio and Size}; 
\path (cs.216)--+(216:2.5)node[force,anchor=36](risk){Total and Systematic Risk}; 
\path (cs.288)--+(288:2.5)node [force,anchor=108](test){Test};
\path[->,thick] 
(cs) edge (ol) 
(cs) edge (cm) 
(cs) edge (risk) 
(cs) edge (p) 
(cs) edge (test);
\end{tikzpicture}

\vfill

Alternative: Pfeilenden sind 3.5\,cm vom Mittelpunkt von (cs) entfernt:

\begin{tikzpicture} 
\node [force](cs) {Cost Structure};
%\draw [very thin] circle[radius=3.5cm];
%
\node [force,anchor=180]at(0:3.5)(p){Accounting Return};
\node [force,anchor=252]at(72:3.5)(ol){Operating Leverage}; 
\node [force,anchor=324]at(144:3.5)(cm){BM ratio and Size}; 
\node [force,anchor=36]at(216:3.5)(risk){Total and Systematic Risk}; 
\node [force,anchor=108]at(288:3.5)(test){Test};
\path[->,thick] 
(cs) edge (ol) 
(cs) edge (cm) 
(cs) edge (risk) 
(cs) edge (p) 
(cs) edge (test);
\end{tikzpicture}
\end{document}
Gruß
Elke

Fabian
Forum-Anfänger
Forum-Anfänger
Beiträge: 26
Registriert: Mi 6. Jun 2012, 08:47

Beitrag von Fabian »

Danke, Elke!

Ich versuche, die Kästchen nach meinem Geschmack zu positionieren. Ich möchte nun, dass die beiden oberen Kästchen im gleichen Winkel von rechts und links abweichen. Da ich die Logik der Positionierung immer noch nicht richtig verstanden habe, bin ich am Pröbeln. Könntest du mir nochmals helfen. Soweit bin ich gekommen:
\documentclass[12pt,leqno,titlepage,a4paper,oneside,listof=flat]{scrartcl}
\usepackage{caption}
\captionsetup{format=plain,justification=justified,font=footnotesize,labelfont=bf,labelsep=colon,}
\usepackage{subcaption}
\usepackage{tikz} 
\tikzset{force/.style={draw,fill=black!14,inner sep=5pt,minimum height=1.2cm, 
  text width=3.8cm,text badly centered,font=\bfseries\scriptsize}} 
\begin{document}

\begin{tikzpicture} 
\node [force](cs) {Cost Structure}; 
\draw [very thin] circle[radius=3.5cm]; 
 
\node [force,anchor=316,fill=black!8]at(136:2.25)(p){Accounting Return}; 
\node [force,anchor=216,fill=black!8]at(36:2.75)(ol){Operating Leverage}; 
\node [force,anchor=180,fill=black!24]at(0:3.5)(cm){BM ratio and Size}; 
\node [force,anchor=90,fill=black!24]at(270:1.75)(risk){Total and Systematic Risk}; 
\node [force,anchor=360,fill=black!24]at(180:3.5)(return){Portfolio Return}; 
\path[->,thick] 
(cs) edge (ol) 
(cs) edge (cm) 
(cs) edge (risk) 
(cs) edge (p) 
(cs) edge (return); 
\end{tikzpicture}

\end{document}
Die Kästche p und ol sollen im gleichen Winkel von der horizontalen oberhalb des cs liegen.

LG, Fabian

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

Beitrag von Beinschuss »

Wenn Du den Winkel von 180° oberhalb der Mitte in drei gleiche Teile teilen möchtest, sind die anzugebenden Werte 180° + 60° = 240° und 240° + 60°=300° (denn 300°+60°=360°). Also: 240 und 300 statt 216 und 316 bei anchor.

Außerdem finde ich es in diesem Fall schöner, die cs als Kreis zu zeichnen, z.B.:
[code]\node [circle,draw](cs) {Cost Structure}; [/code]

Gutes Nächtle

Helmut

Fabian
Forum-Anfänger
Forum-Anfänger
Beiträge: 26
Registriert: Mi 6. Jun 2012, 08:47

Beitrag von Fabian »

Guten Morgen

Besten Dank - nun passts!

LG

Antworten