我用 tex 画了图,并且包含了列出的所有包:
\usepackage[perpage]{footmisc}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{paralist}
\usepackage{uestc/common}
\usepackage{uestc/tocfix}
\usepackage{uestc/ftcenv}
\usepackage{uestc/extra}
\usepackage{url}
\usepackage{pdfpages}
\usepackage{amssymb}
\usepackage{bbding}
\usepackage{subfigure}
\usepackage{hyperref}
\usepackage{listings}
\usepackage{xcolor}
\usepackage{xeCJK}
\usepackage{fancyhdr}
\usepackage{helvet}
\usepackage[eulergreek]{sansmath}
\usepackage{tikz}
\tikzset{font=\footnotesize}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\pgfplotsset{
tick label style = {font=\footnotesize\sansmath\sffamily},
every axis label = {font=\footnotesize\small\sffamily},
legend style = {font=\footnotesize\sansmath\sffamily},
label style = {font=\footnotesize\sansmath\sffamily}}
\usepackage{cite}
\usepackage{graphicx}
\usepackage{gincltex}
\usepackage[cmex10]{amsmath}
\interdisplaylinepenalty=2500
\usepackage{algorithmic}
我画的图如下:
\begin{figure}
\centering
\subfigure[Time of A.]{
\includegraphics[width=0.45\linewidth]{ch/06/figures/timeA.tex}
\label{fig:bolas-response-time}
}%
\subfigure[Time of B.]{
\includegraphics[width=0.45\linewidth]{ch/06/figures/timeB.tex}
\label{fig:bolasplus-response-time}
}
\caption{ Time comparsion.}
\label{fig:response-time}
\end{figure}
这两个tex文件的写法如下:
\pgfplotstableread{
0 105.0 81.3 65.3
1 146.3 131.0 113.7
2 203.0 175.0 143.3
3 226.0 183.7 192.7
4 313.3 245.7 224.7
}\dataset
\begin{tikzpicture}
\pgfplotsset{
/pgfplots/sybar legend/.style={
/pgfplots/legend image code/.code={%
\draw[##1,/tikz/.cd,bar width=10pt,yshift=-0.2em,bar shift=0pt]
plot coordinates {(0cm,0.5em)};},
},
}
\begin{axis}[
width=7.5cm,
height=4.64cm,
ymin=0,
% ymax=320,
ylabel={Time (s)},
xlabel={数据块},
xtick=data,
xticklabels = {
20,
40,
60,
80,
100
},
major x tick style = {opacity=0},
minor x tick num = 0,
minor tick length=0ex,
every node near coord/.append style={
anchor=west,
rotate=90
},
ybar,
bar width=7pt,
sybar legend,
legend entries={native, \bolasplus, \bolas},
legend columns=1,
legend pos=north west,
legend style={draw=none,nodes={inner sep=2pt},nodes=right,fill=none},
]
\addplot[draw=black,fill=green!40] table[x index=0,y index=1] \dataset; %
\addplot[draw=black,fill=blue!40] table[x index=0,y index=2] \dataset; %
\addplot[draw=black,fill=red!40] table[x index=0,y index=3] \dataset; %
\end{axis}
\end{tikzpicture}
但是 ylabel 没有在最终的图片中显示,希望一些 tex 方面的极客可以帮助我,非常感谢。