我有一个由两个图形组成的 Bode 图,我使用了两个 tikz 环境而不是一个,并且我使用 minipage 将图形并排放置。它可以工作,但唯一的问题是它没有与文本居中。我该如何解决这个问题?我是否必须只使用一个 tikz 环境?
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[margin=1in]{geometry}
\usepackage{xcolor}
\usepackage{graphicx,setspace}
\renewcommand{\baselinestretch}{1.5}
\usepackage{tikz}
\usetikzlibrary{angles, arrows.meta,
quotes}
\usetikzlibrary{fit,calc,positioning,decorations.pathreplacing,matrix}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\subsubsection{\underline{\textbf{$K_p > 1$} :}} on parle d'amplification, il y a un ajout de gain qui améliore la précision. D'autre part, une translation vers le haut du diagramme de la magnitude cause un élargissment de la bande passante et donc une amélioration de la rapidité.
\begin{figure}[h]
\begin{minipage}[b]{0.5\textwidth}
\centering
\begin{tikzpicture}
\hspace{2mm}
\begin{axis}[xmode=log,xmin=1e-1,xmax=1e4,ymin=-20,ymax=20,grid=both]
%normale
\draw [blue] (axis cs:1e-1,8) ..controls (axis cs:10,8) .. (axis cs:1e4,-17);
\node at (axis cs:0.2,9) {\small \color{blue} \texttt{K=1}};
%K>1
\draw [green] (axis cs:1e-1,12) .. controls (axis cs:10,12) .. (axis cs: 1e4,-13);
\node at (axis cs:0.2,13) {\small \color{green} \texttt{K>1}};
%K<1
\draw [red] (axis cs: 1e-1,4) .. controls (axis cs:10,4) .. (axis cs: 8000, -20);
\node at (axis cs:0.2,5) {\small \color{red} \texttt{K<1}};
%0dB
\draw [thick] (axis cs:1e-1,0) -- (axis cs:1e4,0);
%omega c red
\draw [red, dashed] (axis cs:20,0) -- (axis cs:20,-20);
\node at (axis cs:13,-1) {\scriptsize \color{red} \texttt{$\omega_c$}};
%omega blue
\draw [blue, dashed] (axis cs:80,0) -- (axis cs:80,-20);
\node at (axis cs:65,-1) {\scriptsize \color{blue} \texttt{$\omega_c$}};
%omega green
\draw [green, dashed] (axis cs:260,0) -- (axis cs:260,-20);
\node at (axis cs:240,-1) {\scriptsize \color{green} \texttt{$\omega_c$}};
\end{axis}
%\fill (5.38,5.4) node[draw] {\color{gray} \texttt{Magnitude(dB)}};
\end{tikzpicture}
\end{minipage}
\begin{minipage}[b]{.5\textwidth}
\centering
\begin{tikzpicture}
\begin{axis}[xmode=log,xmin=1e-1,xmax=1e4,ymin=-180,ymax=-60,grid=both]
%phase
\draw [blue] (axis cs:1e-1,-70) .. controls (axis cs:50,-70) and (axis cs: 50,-180)..(axis cs:1e4,-180);
%marge Phi blue
\draw [>=stealth,blue,->] (axis cs:80,-180) -- (axis cs:80,-137);
\node at (axis cs:55,-158) {\small \color{blue} \texttt{$M_\Phi$}};
%marge Phi Red
\draw [>=stealth,red,->] (axis cs:20,-180) -- (axis cs:20,-110);
\node at (axis cs:12,-150) {\small \color{red} \texttt{$M_\Phi$}};
%marge Phi green
\draw [>=stealth,green,->] (axis cs:260,-180) -- (axis cs:260,-157);
\node at (axis cs:150,-170) {\small \color{green} \texttt{$M_\Phi$}};
\end{axis}
%phase
\fill (5.9,5.4) node[draw] {\color{gray} \texttt{Phase($^\circ$)}};
%figure
%\node at (3.5,-0.8) {\small \texttt{fréquence angulaire (rad/s)}};
%\node at (3.5,-1.25) {\small \color{blue} \texttt{fig 12}};
\end{tikzpicture}
\end{minipage}
\caption{Diagramme de Bode du correcteur proportionnel}
\end{figure}
\end{document}
答案1
正如@AndréC 提到的,图像的宽度太大,要改变它,一个简单的方法是使用scale=.8
每幅图像的 tikz 选项。
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[margin=1in]{geometry}
\usepackage{xcolor}
\usepackage{graphicx,setspace}
\renewcommand{\baselinestretch}{1.5}
\usepackage{tikz}
\usetikzlibrary{angles, arrows.meta,
quotes}
\usetikzlibrary{fit,calc,positioning,decorations.pathreplacing,matrix}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\subsubsection{\underline{\textbf{$K_p > 1$} :}} on parle d'amplification, il y a un ajout de gain qui améliore la précision. D'autre part, une translation vers le haut du diagramme de la magnitude cause un élargissment de la bande passante et donc une amélioration de la rapidité.
\begin{figure}[h]
\begin{minipage}[b]{.5\textwidth}
\centering
\begin{tikzpicture}[scale=.8]
\hspace{2mm}
\begin{axis}[xmode=log,xmin=1e-1,xmax=1e4,ymin=-20,ymax=20,grid=both]
%normale
\draw [blue] (axis cs:1e-1,8) ..controls (axis cs:10,8) .. (axis cs:1e4,-17);
\node at (axis cs:0.2,9) {\small \color{blue} \texttt{K=1}};
%K>1
\draw [green] (axis cs:1e-1,12) .. controls (axis cs:10,12) .. (axis cs: 1e4,-13);
\node at (axis cs:0.2,13) {\small \color{green} \texttt{K>1}};
%K<1
\draw [red] (axis cs: 1e-1,4) .. controls (axis cs:10,4) .. (axis cs: 8000, -20);
\node at (axis cs:0.2,5) {\small \color{red} \texttt{K<1}};
%0dB
\draw [thick] (axis cs:1e-1,0) -- (axis cs:1e4,0);
%omega c red
\draw [red, dashed] (axis cs:20,0) -- (axis cs:20,-20);
\node at (axis cs:13,-1) {\scriptsize \color{red} \texttt{$\omega_c$}};
%omega blue
\draw [blue, dashed] (axis cs:80,0) -- (axis cs:80,-20);
\node at (axis cs:65,-1) {\scriptsize \color{blue} \texttt{$\omega_c$}};
%omega green
\draw [green, dashed] (axis cs:260,0) -- (axis cs:260,-20);
\node at (axis cs:240,-1) {\scriptsize \color{green} \texttt{$\omega_c$}};
\end{axis}
%\fill (5.38,5.4) node[draw] {\color{gray} \texttt{Magnitude(dB)}};
\end{tikzpicture}
\end{minipage}
\begin{minipage}[b]{.4\textwidth}
\centering
\begin{tikzpicture}[scale=.8]
\begin{axis}[xmode=log,xmin=1e-1,xmax=1e4,ymin=-180,ymax=-60,grid=both]
%phase
\draw [blue] (axis cs:1e-1,-70) .. controls (axis cs:50,-70) and (axis cs: 50,-180)..(axis cs:1e4,-180);
%marge Phi blue
\draw [>=stealth,blue,->] (axis cs:80,-180) -- (axis cs:80,-137);
\node at (axis cs:55,-158) {\small \color{blue} \texttt{$M_\Phi$}};
%marge Phi Red
\draw [>=stealth,red,->] (axis cs:20,-180) -- (axis cs:20,-110);
\node at (axis cs:12,-150) {\small \color{red} \texttt{$M_\Phi$}};
%marge Phi green
\draw [>=stealth,green,->] (axis cs:260,-180) -- (axis cs:260,-157);
\node at (axis cs:150,-170) {\small \color{green} \texttt{$M_\Phi$}};
\end{axis}
\end{tikzpicture}
\end{minipage}
\caption{Diagramme de Bode du correcteur proportionnel}
\end{figure}
\end{document}