PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Graph/Bild verkleinern mittels pgf/figure aber wie?



noob222
19-03-2009, 10:22
Hallo, unten ist mein Code aufgeführt. Zudem findet ihr im Anhang die Kompilierte Version. Also ich habe in der Beamer-Classe mit dem Packet tikzpicture(pgf) zwei Graphen gezeichnet. Alles in Ordung soweit.
Nun habe ich genau die gleichen Graphen auch in mein Dokument (\documentclass{article}) eingefügt. Soweit so gut, nur kriege ich in dem rechten Graphen wie auch im Anhang zu sehen ist in den Knoten rechtecke. Woher diese kommen keine Ahnung. Das ist aber nicht das größere Problem.
Aber für eine Aufklärung wäre ich dankbar.

Nun zu der eigentlichen Frage. Wie kann ich in einer Figure-Umgebung ohne \includegraphics mein Abbildung/Graphen verkleinern? Ich benutze kein \includegraphics weil ich ja in der Figure-Umgebung mittel tikzpicture meinen Graphen erstelle. Andersrum könnte ich doch auch eventuell schon in der Tikzpicture-Umgebung meinen Graphen verkleinern aber ich konnte nicht herausfinden wie das geht. Ich habe versucht mit der Minipage-Umgebung die jeweiligen Graphen zu verkleinern aber so richtig funktioniert das ja auch nicht, weil Minipage ja nur in diesem Fall zwei Spalten erstellt und diese nicht verkleinern kann.

Ziel ist es die Abbildung ingesamt zu verkleinern (z.B. von 100% auf 60%). Kann mir einer behilflich sein?
Vielen Dank




\begin{figure}[h!]
\begin{minipage}[hbt]{3cm}
\begin{tikzpicture}[every node/.style={draw}]
%clique und independent-set
\node[circle,draw=black,fill=white] (1) at (0,4.5){\textcolor{white}{1}};
\node[circle,draw=black,fill=white] (2) at (0,3) {$x_1$};
\node[circle,draw=black,fill=white] (3) at (0,1.5) {$x_2$};
\node[circle,draw=black,fill=white] (4) at (0,0) {$x_3$};
\node[circle,draw=black,fill=black] (5) at (3,3.5) {\textcolor{black}{5}};
\node[circle,draw=black,fill=black] (6) at (3,2) {\textcolor{black}{6}};
\node[circle,draw=black,fill=black] (7) at (3,0.5) {\textcolor{black}{7}};
\node[circle,draw=black,fill=black] (8) at (3,-1) {\textcolor{black}{8}};
\node[draw=white,fill=white] (9) at (0,-1) {};
\node[draw=white,fill=white] (10) at (0,5.5) {};
\node[draw=white,fill=white] (11) at (3,4.5) {};
\node[draw=white,fill=white] (12) at (3,-2) {};

\draw (1)--(5);
\draw (5)--(6);
\draw (6)--(7);
\draw (7)--(8);
\draw (2)--(5); \draw (2)--(6); \draw (2)--(7); \draw (2)--(8);
\draw (3)--(5); \draw (3)--(6); \draw (3)--(7); \draw (3)--(8);
\draw (4)--(5); \draw (4)--(6); \draw (4)--(7); \draw (4)--(8);
%Knoten mit Kreis-Kanten verbinden
\draw (5) .. controls +(right:1cm) and +(right:1cm) .. (7)
\foreach \p in {0,0.2,...,1} {node[sloped]{}};
\draw (5) .. controls +(right:1.5cm) and +(right:1.5cm) .. (8)
\foreach \p in {0,0.2,...,1} {node[sloped]{}};
\draw (6) .. controls +(right:0.5cm) and +(right:0.5cm) .. (8)
\foreach \p in {0,0.2,...,1} {node[sloped]{}};
%clique und inedpendent-set umkreisen. Als erstes zwei Knoten für IS, dann zwei Konoten für Clique
\draw[dashed,blue] (9) .. controls +(left:1cm) and +(left:1cm) .. (10)
\foreach \p in {0,0.2,...,1} {node[sloped]{}};
\draw[dashed,blue] (10) .. controls +(right:1cm) and +(right:1cm) .. (9)
\foreach \p in {0,0.2,...,1} {node[sloped]{}};
\draw[dashed,red] (11) .. controls +(left:1cm) and +(left:1cm) .. (12)
\foreach \p in {0,0.2,...,1} {node[sloped]{}};
\draw[dashed,red] (12) .. controls +(right:2cm) and +(right:2cm) .. (11)
\foreach \p in {0,0.2,...,1} {node[sloped]{}};
\end{tikzpicture}
\end{minipage}
\hfill
%Fräbung von G mit 5 Farben
\begin{minipage}[hbt]{6cm}
\begin{tikzpicture}[every node/.style={draw}]
%clique und independent-set
\node[circle,draw=gray,fill=gray] (1) at (0,4.5) {\textcolor{gray}{1}};
\node[circle,draw=gray,fill=gray] (2) at (0,3) {\textcolor{white}{$x_1$}};
\node[circle,draw=gray,fill=gray] (3) at (0,1.5) {\textcolor{white}{$x_2$}};
\node[circle,draw=gray,fill=gray] (4) at (3,-2.5) {\textcolor{white}{$x_3$}};
\node[circle,draw=red,fill=red] (5) at (3,3.5) {\textcolor{red}{5}};
\node[circle,draw=yellow,fill=yellow] (6) at (3,2) {\textcolor{yellow}{6}};
\node[circle,draw=green,fill=green] (7) at (3,0.5) {\textcolor{green}{7}};
\node[circle,draw=blue,fill=blue] (8) at (3,-1) {\textcolor{blue}{8}};
\draw (1)--(5);
\draw (5)--(6);
\draw (6)--(7);
\draw (7)--(8);
\draw (2)--(5); \draw (2)--(6); \draw (2)--(7); \draw (2)--(8);
\draw (3)--(5); \draw (3)--(6); \draw (3)--(7); \draw (3)--(8);
\draw (4)--(5); \draw (4)--(6); \draw (4)--(7); \draw (4)--(8);
%Knoten mit Kresi-Kanten verbinden
\draw (5) .. controls +(right:1cm) and +(right:1cm) .. (7)
\foreach \p in {0,0.2,...,1} {node[sloped]{}};
\draw (5) .. controls +(right:1.5cm) and +(right:1.5cm) .. (8)
\foreach \p in {0,0.2,...,1} {node[sloped]{}}
\draw (6) .. controls +(right:0.5cm) and +(right:0.5cm) .. (8)
\foreach \p in {0,0.2,...,1} {node[sloped]{}};
\draw (4) .. controls +(right:2.5cm) and +(right:2.5cm) .. (5)
\foreach \p in {0,0.2,...,1} {node[sloped]{}};
\draw (4) .. controls +(right:1.5cm) and +(right:1.5cm) .. (6)
\foreach \p in {0,0.3,...,1} {node[sloped]{}};
\draw (4) .. controls +(right:1cm) and +(right:1cm) .. (7)
\foreach \p in {0,0.1,...,1} {node[sloped]{}};
\end{tikzpicture}
\end{minipage}
\caption{Färbung und Eindeutigkeit von G}
\label{fig:chrom-Zahl}
\end{figure}

mechanicus
19-03-2009, 11:16
Hallo,

dein Code läuft bei mir nicht mal. Aber das sollte funktionieren:


\begin{tikzpicture}[every node/.style={draw},scale=0.5]

Gruß
Marco

voss
19-03-2009, 11:39
dein Code läuft bei mir nicht mal.


er hat am Ende des zweiten Beispiels ständig die ; vergessen ...

Herbert

noob222
19-03-2009, 11:52
vielen dank, es funktioniert.

Ihr könnt es nicht kompilieren weil ihr wahrscheinlich die packete
\usepackage{graphicx}
\usepackage{tikz}
nicht eingebunden habt. dannach sollte es funktionieren.
Die ";" sind schon überall richtig

voss
19-03-2009, 12:26
vielen dank, es funktioniert.

Ihr könnt es nicht kompilieren weil ihr wahrscheinlich die packete
\usepackage{graphicx}
\usepackage{tikz}
nicht eingebunden habt. dannach sollte es funktionieren.
Die ";" sind schon überall richtig

wenn sie _fehlen_, sind sie wohl kaum richtig ...
Hier nur mal so zum Vergleich das 2. Beispiel mit PSTricks:


\documentclass[12pt,a4paper]{article}
\usepackage{pst-node}
\def\Box{\rput(0,0){\psframe[fillstyle=none,linecolor=black]%
(-0.15,-0.15)(0.15,0.15)}}
\begin{document}

\begin{psmatrix}[radius=12pt,rowsep=2pt,colsep=2cm,mnode=Circle,
fillstyle=solid,fillcolor=black!50,linecolor=black !50]
\\
& [linecolor=red,fillcolor=red]\\
\color{white}$x_1$ \\
& [linecolor=yellow,fillcolor=yellow]\\
\color{white}$x_2$ \\
& [linecolor=green,fillcolor=green]\Box\\
[mnode=R]\rule{0pt}{24pt}\\
& [linecolor=blue,fillcolor=blue]\Box\\
[mnode=R]\rule{0pt}{24pt}\\
& \color{white}$x_3$\\
\end{psmatrix}
\ncline{1,1}{2,2}
\ncline{3,1}{2,2}\ncline{3,1}{4,2}\ncline{3,1}{6,2 }\ncline{3,1}{8,2}
\ncline{5,1}{2,2}\ncline{5,1}{4,2}\ncline{5,1}{6,2 }\ncline{5,1}{8,2}
\ncline{2,2}{10,2}
\psset{angleA=-15,angleB=15}
\nccurve{2,2}{6,2}\nccurve{2,2}{8,2}\nccurve{2,2}{ 10,2}
\nccurve{4,2}{8,2}\nccurve{4,2}{10,2}
\nccurve{6,2}{10,2}

\end{document}


Herbert

krihaa
19-03-2009, 16:28
Hallo,

du hast bei der zweiten Grafik beim zweiten \foreach doch ein ; vergessen. Die Quadrate kriegst du weg, wenn du [every node/.style={draw}] entfernst.

Gruß