I have a problem with putting two tikzpictures next to each other.
I have tried using minipages too, but that ain’t working too.
\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[left = 23mm, bottom = 24mm, top = 24mm, right = 29mm]{geometry}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{circuitikz}
\usetikzlibrary{arrows,shapes,positioning}
\usepackage{subfig}
\begin{figure}[h]
\centering
\begin{subfloat}[lfig1] {
\centering
\begin{tikzpicture}
\draw[thin, ->] (1.2,0) -- (1.2,5.4) node[below left]{$\phi_2(t)$};
\draw[thin, ->] (0,1.2) -- (5.4,1.2) node[below left]{$\phi_1(t)$};
\draw[very thick, blue, ->] (1.2,1.2) -- (1.2,4.15) node[black][midway, right=1mm]{$s_2$};
\draw[very thick,red,->] (1.2,1.2) -- (4.15,1.2) node[black][midway, above=1mm]{$s_1$};
\draw[thin, dashed] (1.2,4.2) -- (4.2,1.2) node[midway, above right]{$\sqrt{2E_b}$};
\end{tikzpicture}
}
\end{subfloat}
\hspace{10pt}
\begin{subfloat}[lfig2] {
\centering
\begin{tikzpicture}
\draw[thin, ->] (0,1.2) -- (8.4,1.2) node[below left]{$\phi_1(t)$};
\draw[thin, ->] (4.2,0) -- (4.2,3.4) node[below left]{$\phi_2(t)$};
\draw[thick, blue, ->] (4.2,1.2) -- (1.25,1.2) node[midway, above=1mm]{$s_2$};
\draw[thick, red, ->] (4.2,1.2) -- (7.15,1.2) node[midway, above=1mm]{$s_1$};
\end{tikzpicture}
}
\end{subfloat}
\caption{captionfig1}
\label{Slika:fig1}
\end{figure}
So, I need to put these two graphs in the same ‘row’. I have tried using minipages with different sized \linewidth, but that lead me nowhere.
I need it to be shown like this: https://prnt.sc/CM8kFW-DvRQZ
>Solution :
Empty lines in latex denote the end of a paragraph. If you don’t want a line break, don’t end the current paragraph by adding all these empty lines.
\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[left = 23mm, bottom = 24mm, top = 24mm, right = 29mm]{geometry}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{circuitikz}
\usetikzlibrary{arrows,shapes,positioning}
\usepackage{subfig}
\begin{document}
\begin{figure}[h]
\centering
\begin{subfloat}[lfig1] {
\centering
\begin{tikzpicture}
\draw[thin, ->] (1.2,0) -- (1.2,5.4) node[below left]{$\phi_2(t)$};
\draw[thin, ->] (0,1.2) -- (5.4,1.2) node[below left]{$\phi_1(t)$};
\draw[very thick, blue, ->] (1.2,1.2) -- (1.2,4.15) node[black][midway, right=1mm]{$s_2$};
\draw[very thick,red,->] (1.2,1.2) -- (4.15,1.2) node[black][midway, above=1mm]{$s_1$};
\draw[thin, dashed] (1.2,4.2) -- (4.2,1.2) node[midway, above right]{$\sqrt{2E_b}$};
\end{tikzpicture}
}
\end{subfloat}
\hspace{10pt}
\begin{subfloat}[lfig2] {
\centering
\begin{tikzpicture}
\draw[thin, ->] (0,1.2) -- (8.4,1.2) node[below left]{$\phi_1(t)$};
\draw[thin, ->] (4.2,0) -- (4.2,3.4) node[below left]{$\phi_2(t)$};
\draw[thick, blue, ->] (4.2,1.2) -- (1.25,1.2) node[midway, above=1mm]{$s_2$};
\draw[thick, red, ->] (4.2,1.2) -- (7.15,1.2) node[midway, above=1mm]{$s_1$};
\end{tikzpicture}
}
\end{subfloat}
\caption{captionfig1}
\label{Slika:fig1}
\end{figure}
\end{document}