在 Latex 中并排放置图表

在 Latex 中并排放置图表

我有两个图表,我想将它们并排放在 Latex 中。目前,它们只能一个在另一个下面显示。两者的格式均为:

\documentclass[11pt,a4paper]{article}

\usepackage[sort]{natbib}
\usepackage{fancyhdr}
\usepackage{graphicx}
\usepackage{amsmath,amsfonts,amsthm,nicefrac,latexsym,amsfonts,amsbsy,bm}
\usepackage[nottoc,numbib]{tocbibind}

\usepackage{lipsum}
\usepackage{hyperref}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepackage{mwe}

\begin{document}

\begin{tikzpicture}[xscale=0.8,yscale=2,domain=0.5:7]

% Axes

\draw[thick,->] (-.5,0) -- (10,0) node[right] {x};

\draw[thick,->] (0,-0.1) -- (0,2.5) node[right] {f(x)};

% Curve

\draw[color=white] (4.6,2.2) node[above,black]{\Large {Backward Difference}};

\draw[thick,color=black,domain=1.25:9,smooth,variable=\x] plot ({10-\x},{-ln(\x)+2.5});

\draw[very thick,color=red] (3,0.555)--(4.640957,0.825) node[above left,black]{Approximation};

\draw[very thick,color=blue,domain=3.5:8.52,smooth,variable=\x] plot (\x,{0.81 + 0.2*(\x-4.640957) ) }) node[below right,black] {Actual Derivative};

% Points

\foreach \point in {(3,0.555),(4.640957,0.825)}{% points \fill \point circle (1.5pt);}

% Axis labels

\foreach \x/\xtext in {3/{x_{i-1}},4.640957/{x_i},7/{x_{i+1}}} \draw(\x cm,1pt) -- (\x cm,-1pt) node[anchor=north,fill=white] {\xtext};

\end{tikzpicture}

\end{document}

相关内容