'I do not know how to create this graph with tikz in latex
I tried to create this graph
in latex but I didn't succeed. I tried this code :
\begin{tikzpicture}
%% vertices
\draw[fill=black] (0,0) circle (1.5pt);
\draw[fill=black] (2,0) circle (1.5pt);
\draw[fill=black] (1,3/2) circle (1.5pt);
%% vertex labels
\node at (-0.5,0) {$v_{1}$};
\node at (2.5,0) {$v_{2}$};
\node at (1,3.8/2) {$v_{3}$};
%%% edges
\draw[thick] (0,0) -- (2,0) -- (0,0) -- (1,3/2) -- (2,0) -- (1,3/2);
\end{tikzpicture}
Solution 1:[1]
You are definitely on the right way. What I suggest, is that you build a table which is containing your 8 slightly different Tikz graphics.
-------------------------------------
| graph1 | graph2 | graph3 | graph4 |
| text1 | text 2 | text3 | text4 |
-------------------------------------
| graph5 | graph6 | graph7 | graph8 |
| text5 | text 6 | text7 | text8 |
-------------------------------------
caption
In total you are going to have a 4 by 4 table with 3 horizontal lines (\hline
)
It could be similiar to this:
---------------------- UPDATED SOLUTION:------------------------------
\begin{table}
\setlength{\tabcolsep}{1mm} % separator between columns
\def\arraystretch{1.0} % vertical stretch factor
\centering
\begin{tabular}{|c|c|c|c|}
\hline
\begin{tikzpicture}
%% vertices
\draw[fill=black] (0,0) circle (1.5pt);
\draw[fill=black] (3/2,0) circle (1.5pt);
\draw[fill=black] (0.75,1.2) circle (1.5pt);
%% vertex labels
\node at (-0.2,-0.3) {$v_{3}$};
\node at (1.7,-0.3) {$v_{2}$};
\node at (0.75,1.5) {$v_{1}$};
\end{tikzpicture}
& \begin{tikzpicture}
%% vertices
\draw[fill=black] (0,0) circle (1.5pt);
\draw[fill=black] (3/2,0) circle (1.5pt);
\draw[fill=black] (0.75,1.2) circle (1.5pt);
%% vertex labels
\node at (-0.2,-0.3) {$v_{3}$};
\node at (1.7,-0.3) {$v_{2}$};
\node at (0.75,1.5) {$v_{1}$};
%%% edges
\draw[thick] (3/2,0) -- (0.75,1.2);
\end{tikzpicture}
& \begin{tikzpicture}
%% vertices
\draw[fill=black] (0,0) circle (1.5pt);
\draw[fill=black] (3/2,0) circle (1.5pt);
\draw[fill=black] (0.75,1.2) circle (1.5pt);
%% vertex labels
\node at (-0.2,-0.3) {$v_{3}$};
\node at (1.7,-0.3) {$v_{2}$};
\node at (0.75,1.5) {$v_{1}$};
%%% edges
\draw[thick] (0,0) -- (3/2,0) ;
\end{tikzpicture}
& \begin{tikzpicture}
%% vertices
\draw[fill=black] (0,0) circle (1.5pt);
\draw[fill=black] (3/2,0) circle (1.5pt);
\draw[fill=black] (0.75,1.2) circle (1.5pt);
%% vertex labels
\node at (-0.2,-0.3) {$v_{3}$};
\node at (1.7,-0.3) {$v_{2}$};
\node at (0.75,1.5) {$v_{1}$};
%%% edges
\draw[thick] (0,0) -- (0.75,1.2);
\end{tikzpicture}
\\ \( (1-p)^3\) & \( p(1-p)^2\) & \( p(1-p)^2\) & \( p(1-p)^2\)
\\ \hline
\begin{tikzpicture}
%% vertices
\draw[fill=black] (0,0) circle (1.5pt);
\draw[fill=black] (3/2,0) circle (1.5pt);
\draw[fill=black] (0.75,1.2) circle (1.5pt);
%% vertex labels
\node at (-0.2,-0.3) {$v_{3}$};
\node at (1.7,-0.3) {$v_{2}$};
\node at (0.75,1.5) {$v_{1}$};
%%% edges
\draw[thick] (0,0) -- (3/2,0) -- (0,0) -- (0.75,1.2);
\end{tikzpicture}
& \begin{tikzpicture}
%% vertices
\draw[fill=black] (0,0) circle (1.5pt);
\draw[fill=black] (3/2,0) circle (1.5pt);
\draw[fill=black] (0.75,1.2) circle (1.5pt);
%% vertex labels
\node at (-0.2,-0.3) {$v_{3}$};
\node at (1.7,-0.3) {$v_{2}$};
\node at (0.75,1.5) {$v_{1}$};
%%% edges
\draw[thick] (0,0) -- (0.75,1.2) -- (3/2,0) -- (0.75,1.2);
\end{tikzpicture}
& \begin{tikzpicture}
%% vertices
\draw[fill=black] (0,0) circle (1.5pt);
\draw[fill=black] (3/2,0) circle (1.5pt);
\draw[fill=black] (0.75,1.2) circle (1.5pt);
%% vertex labels
\node at (-0.2,-0.3) {$v_{3}$};
\node at (1.7,-0.3) {$v_{2}$};
\node at (0.75,1.5) {$v_{1}$};
%%% edges
\draw[thick] (0,0) -- (3/2,0) -- (0.75,1.2);
\end{tikzpicture}
& \begin{tikzpicture}
%% vertices
\draw[fill=black] (0,0) circle (1.5pt);
\draw[fill=black] (3/2,0) circle (1.5pt);
\draw[fill=black] (0.75,1.2) circle (1.5pt);
%% vertex labels
\node at (-0.2,-0.3) {$v_{3}$};
\node at (1.7,-0.3) {$v_{2}$};
\node at (0.75,1.5) {$v_{1}$};
%%% edges
\draw[thick] (0,0) -- (3/2,0) -- (0,0) -- (0.75,1.2) -- (3/2,0) -- (0.75,1.2);
\end{tikzpicture}
\\ \( p^2(1-p)\) & \( p^2(1-p)\) & \( p^2(1-p)\) & \( p^3\)
\\ \hline
\end{tabular}
\caption{$L'espace\,\,de\,\,probabilit\acute{e}\,\,G_{3,p}$}
\end{table}
Solution 2:[2]
A table as in the other answer works well with or without borders but, if you can avoid the borders, you may consider using scope
s to position accordingly:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=.9]
\begin{scope}[border=5mm]
%\draw (0,0) -- (1,2) -- (2,0) -- (0,0);
\draw[fill=white] %
(1,2) circle (3pt) node[above] {$v_1$}
(2,0) circle (3pt) node[below right] {$v_2$}
(0,0) circle (3pt) node[below left] {$v_3$};
\node at (1,-.8) {text 1};
\end{scope}
%
\begin{scope}[xshift=40mm]
\draw %(0,0) --
(1,2) -- (2,0);% -- (0,0);
\draw[fill=white] %
(1,2) circle (3pt) node[above] {$v_1$}
(2,0) circle (3pt) node[below right] {$v_2$}
(0,0) circle (3pt) node[below left] {$v_3$};
\node at (1,-.8) {text 2};
\end{scope}
%
% ...
%
\begin{scope}[xshift=40mm,yshift=-40mm]
\draw (0,0) -- (1,2) -- (2,0);% -- (0,0);
\draw[fill=white] %
(1,2) circle (3pt) node[above] {$v_1$}
(2,0) circle (3pt) node[below right] {$v_2$}
(0,0) circle (3pt) node[below left] {$v_3$};
\node at (1,-.8) {text 6};
\end{scope}
%
% ...
%
\end{tikzpicture}
\end{document}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | MattAllegro |