1. 二维图
\documentclass{article}
\usepackage{xcolor}
%\usepackage{datatool}
\usepackage{tikz,pgfplots,filecontents}
\begin{document}
%\begin{tikzpicture}
%\begin{axis}[scatter/classes={
%a={mark=square*,blue},%
% b={mark=triangle*,red},%
% c={mark=o,draw=black,fill=black}}]
%% \addplot[] is better than \addplot+[] here: % it avoids scalings of the cycle list
%\addplot[scatter,only marks]
% plot[scatter src=explicit symbolic]
% coordinates {
%(0.1,0.15) [a] (0.45,0.27) [c] (0.02,0.17) [a] (0.06,0.1) [a] (0.9,0.5) [b] (0.5,0.3) [c] (0.85,0.52) [b] (0.12,0.05) [a] (0.73,0.45) [b] (0.53,0.25) [c] (0.76,0.5) [b] (0.55,0.32) [c]
% };
%\end{axis}
%\end{tikzpicture}
%
%
%\pgfplotsset{every axis/.append style={ font=\large,
% line width=1pt,
%tick style={line width=0.8pt}}}
%\begin{tikzpicture}
%\begin{semilogyaxis}[
%legend style={at={(0.03,0.03)},
%anchor=south west}, xlabel=\textsc{Dof}, ylabel=$L_2$ Error]
% % see above for this macro:
% \plotcoords
% \legend{$d=2$,$d=3$,$d=4$,$d=5$,$d=6$}
% \end{semilogyaxis}
%\end{tikzpicture}
\begin{filecontents*}{SNRMSE.data}
SNR R2MPGp2 R2MPGp1 LSSDP LScADMM LUDADMM LUDcADMM IRLS IRLSc
0.0156 1.7997 1.9030 1.3614 0.8301 0.6382 1.9067 1.5447 0.5753
0.0312 0.7769 1.6481 0.6431 0.1766 0.2060 0.1099 0.6056 0.0515
0.0625 0.0117 0.0219 0.1689 0.0594 0.0800 0.0219 0.0117 0.0325
0.1250 0.0239 0.0020 0.0239 0.0329 0.0377 0.0181 0.0020 0.0282
0.2500 0.0023 0.0006 0.0023 0.0258 0.0067 0.0251 0.0006 0.0264
0.5000 0.0004 0.0002 0.0004 0.0248 0.0007 0.0288 0.0002 0.0265
1.0000 0.0002 0.0001 0.0002 0.0247 0.0003 0.0312 0.0001 0.0267
4.0000 0.0001 0.00001 0.0001 0.0246 0.0001 0.0342 0.00001 0.0261
\end{filecontents*}
\begin{tikzpicture}%[scale=0.95]
\pgfplotsset{every axis legend/.append style={ at={(1.02,1)},
anchor=north west}}
\begin{loglogaxis}[
%ytick={0.02, 0.1,...,0.1},
tick label style={/pgf/number format/fixed},
xlabel={$d$},
ylabel={RMSE}, %legend pos=north east %, y=20cm/3
]
\addplot[color=blue,mark=*] table[x=SNR,y=R2MPGp2] {SNRMSE.data};
\addplot[color=red,mark=square] table[x=SNR,y=R2MPGp1] {SNRMSE.data};
\addplot[color=green,mark=+] table[x=SNR,y=LSSDP] {SNRMSE.data};
\addplot[color=cyan,mark=x] table[x=SNR,y=LScADMM] {SNRMSE.data};
\addplot[color=olive,mark=x] table[x=SNR,y=LUDADMM] {SNRMSE.data};
\addplot[color=orange,mark=otimes] table[x=SNR,y=LUDcADMM] {SNRMSE.data};
\addplot[color=teal,mark=o] table[x=SNR,y=IRLS] {SNRMSE.data};
\addplot[color=violet,mark=triangle] table[x=SNR,y=IRLSc] {SNRMSE.data};
\legend{R2MPGp2, R2MPGp1, LSSDP, LScADMM, LUDADMM, LUDcADMM, IRLS, IRLSc}
\end{loglogaxis}
\end{tikzpicture}
%\begin{tikzpicture}
%\begin{loglogaxis}[%\begin{semilogyaxis}[
% xlabel={Degrees of freedom},
%ylabel={$L_2$ Error} ]
%\addplot coordinates {
%(5,8.312e-02) (129,2.102e-03) (1793,4.442e-05)
%(17,2.547e-02) (49,7.407e-03) (321,5.874e-04) (769,1.623e-04) (4097,1.207e-05) (9217,3.261e-06)};
%\addplot coordinates{
%(7,8.472e-02) (31,3.044e-02) (111,1.022e-02) (351,3.303e-03) (1023,1.039e-03) (2815,3.196e-04) (7423,9.658e-05) (18943,2.873e-05) (47103,8.437e-06)
%};
%
%\addplot coordinates{ (9,7.881e-02)
%(769,4.454e-03) (23297,1.723e-04)
%};
%
%\addplot coordinates{ (11,6.887e-02)
%(1471,5.334e-03) (61183,2.628e-04)
%};
%
%\addplot coordinates{ (13,5.755e-02)
%(49,3.243e-02) (209,1.232e-02) (2561,1.551e-03) (7937,5.236e-04) (65537,5.545e-05) (178177,1.751e-05)
%(71,3.177e-02) (351,1.341e-02) (5503,2.027e-03) (18943,7.415e-04) (187903,9.063e-05) (553983,3.053e-05)
%(97,2.925e-02) (545,1.351e-02) (2561,5.842e-03) (10625,2.397e-03) (40193,9.414e-04)
%(141569,3.564e-04) (471041,1.308e-04) (1496065,4.670e-05) };
%\legend{$d=2$,$d=3$,$d=4$,$d=5$,$d=6$}
%\end{loglogaxis}[%\end{semilogyaxis}
%\end{tikzpicture}
%
\end{document}
运行结果如下:
图二
\begin{filecontents*}{SNRMSE.data}
SNR MPGp2 MPGp1 LSSDP LScAM LUDAM LUDcAM IRLS IRLSc
%0.0156 1.7997 1.9030 1.3614 0.8301 0.6382 1.9067 1.5447 0.5753
% 0.0312 0.7769 1.6481 0.6431 0.1766 0.2060 0.1099 0.6056 0.0515
0.0625 0.0117 0.0219 0.1689 0.0594 0.0800 0.0219 0.0117 0.0325
0.1250 0.0239 0.0020 0.0239 0.0329 0.0377 0.0181 0.0020 0.0282
0.2500 0.0023 0.0006 0.0023 0.0258 0.0067 0.0251 0.0006 0.0264
0.5000 0.0004 0.0002 0.0004 0.0248 0.0007 0.0288 0.0002 0.0265
1.0000 0.0002 0.0001 0.0002 0.0247 0.0003 0.0312 0.0001 0.0267
%4.0000 0.0001 0.00001 0.0001 0.0246 0.0001 0.0342 0.00001 0.0261
\end{filecontents*}
\begin{tikzpicture}%[scale=0.95]
\pgfplotsset{every axis legend/.append style={ at={(1.02,1)},
anchor=north west}}
\begin{loglogaxis}[
xtick={0.0625,0.125,0.25,0.5,1,2},
xticklabels={$\frac{1}{16}$,$\frac{1}{8}$,$\frac{1}{4}$,$\frac{1}{2}$,$1$,2},
%tick label style={/pgf/number format/fixed},
line width=1pt,
xlabel={SNR},
ylabel={MSE}, %legend pos=north east %, y=20cm/3
]
\addplot[color=blue,mark=*] table[x=SNR,y=MPGp2] {SNRMSE.data};
\addplot[color=red,mark=square] table[x=SNR,y=MPGp1] {SNRMSE.data};
\addplot[color=green,mark=+] table[x=SNR,y=LSSDP] {SNRMSE.data};
\addplot[color=cyan,mark=x] table[x=SNR,y=LScAM] {SNRMSE.data};
\addplot[color=olive,mark=x] table[x=SNR,y=LUDAM] {SNRMSE.data};
\addplot[color=orange,mark=otimes] table[x=SNR,y=LUDcAM] {SNRMSE.data};
\addplot[color=teal,mark=o] table[x=SNR,y=IRLS] {SNRMSE.data};
\addplot[color=violet,mark=triangle] table[x=SNR,y=IRLSc] {SNRMSE.data};
\legend{MPGp2, MPGp1, LSSDP, LScAM, LUDAM, LUDcAM, IRLS, IRLSc}
\end{loglogaxis}
\end{tikzpicture}
如下所示
显示图像
\begin{figure}[H]
\centering
\subfigure[空间收敛阶]{
\begin{minipage}{6cm}
\centering
\includegraphics[width=6cm,height=5.6cm]{figs/emd1252orgz.jpg}
\end{minipage}
}
\subfigure[时间收敛阶]{
\begin{minipage}{6cm}
\centering
\includegraphics[width=6cm,height=5.6cm]{figsa/1DMTFSDE_Space_Exp1.eps}
\end{minipage}
}
\caption{算例 2.2.1空间和时间收敛阶}\label{1DMTFSDE_Exp1}
\end{figure}
\begin{table}[h]
\centering
\begin{tabular}{cccccccccc}
\toprule
Image &\multicolumn{2}{c}{text}&\multicolumn{2}{c}{circle}\\
\cline{2-3}\cline{4-5}
method & \small{PSNR} &\small{time} & \small{PSNR} &\small{time}\\
\midrule
TRPCA &17.73&10.588&20.55&10.793\\
SNN &18.85&0.713&16.23&0.764\\
LTefit &\textbf{20.95}&\textbf{1.042}&\textbf{21.55}&\textbf{1.106}\\
\bottomrule
\end{tabular}
\caption{ PSNR and running time on grayscale image}\label{huidubiao}
\end{table}
光速搞定 LaTeX 表格
参考文献