Skip to content

Commit

Permalink
docs: add pgfplots example (#998)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexaraWu authored Dec 27, 2023
1 parent 2cbbecf commit 0eff217
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 19 deletions.
67 changes: 67 additions & 0 deletions assets/energy-distrib.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
radial,energy
0.181,6.6900E-03
0.532,1.2004E-01
0.865,6.2542E-01
1.18,2.0861E+00
1.48,5.5475E+00
1.76,1.2735E+01
2.02,2.6185E+01
2.27,4.9240E+01
2.51,8.5867E+01
2.73,1.4031E+02
2.94,2.1660E+02
3.14,3.1815E+02
3.33,4.4733E+02
3.51,6.0533E+02
3.68,7.9218E+02
3.83,1.0069E+03
3.98,1.2706E+03
4.13,1.5886E+03
4.26,1.9344E+03
4.39,2.3028E+03
4.51,2.6876E+03
4.62,3.0824E+03
4.73,3.4803E+03
4.83,3.8730E+03
4.92,4.2502E+03
5.01,4.6567E+03
5.10,5.1085E+03
5.18,5.5620E+03
5.25,6.0060E+03
5.33,6.4320E+03
5.39,6.8350E+03
5.46,7.2112E+03
5.52,7.5566E+03
5.58,7.9015E+03
5.63,8.2540E+03
5.68,8.5858E+03
5.73,8.8873E+03
5.77,9.1404E+03
5.82,9.3077E+03
5.86,9.3189E+03
5.90,9.0676E+03
5.93,8.5082E+03
5.97,7.5684E+03
6.00,6.6227E+03
6.03,5.7336E+03
6.06,4.9303E+03
6.09,4.2094E+03
6.11,3.5665E+03
6.14,2.9973E+03
6.16,2.4969E+03
6.18,2.0604E+03
6.20,1.6826E+03
6.22,1.3579E+03
6.24,1.0813E+03
6.26,8.4809E+02
6.27,6.5369E+02
6.29,4.9369E+02
6.30,3.6385E+02
6.32,2.6020E+02
6.33,1.7908E+02
6.34,1.1713E+02
6.35,7.1338E+01
6.37,3.9001E+01
6.38,1.7739E+01
6.39,5.4680E+00
6.40,3.8068E-01
40 changes: 30 additions & 10 deletions contents/floats.tex
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,39 @@ \section{插图}
\subsection{单个图形}

图要有图题,研究生图题采用中英文对照,并置于图的编号之后,图的编号和图题应置于图
下方的居中位置。引用图应在图题右上角标出文献来源。当插图中组成部件由数字或字母等
编号表示时,可在插图下方添加图注进行说明,如图~\ref{fig:cn_100t} 所示。
下方的居中位置。引用图应在图题右上角标出文献来源。文中必须有关于本插图的提示,如
“见图~\ref{fig:energy-distrib}”、“如图~\ref{fig:energy-distrib} 所示”等。该页空
白不够排写该图整体时,则可将其后文字部分提前排写,将图移到次页。

\begin{figure}[!htp]
\centering
\includegraphics[width=4cm]{cn_100t.png} \\
1.立柱 2.提升释放机构 3.标准冲击加速度计 \\
4.导轨 5.重锤 6.被校力传感器 7.底座 \\
\bicaption[出现在插图索引中]
{单个图形示例\cite{He1999}。如果表格的标题很长,那么在表格索引中就会很不美观。可
以在前面用中括号写一个简短的标题,这个标题会出现在索引中。}
{Stay hungry, stay foolish.}
\label{fig:cn_100t}
\begin{tikzpicture}
\begin{axis}[
width=12cm,
height=9cm,
xmin=0, xmax=7,
xlabel={$r$ (\unit{\milli\metre})},
ymin=-1000, ymax=11000,
ylabel={Energy (\unit[per-mode=symbol]{\watt\per\cubic\metre})},
scaled ticks=false,
tick label style={
/pgf/number format/1000 sep=,
font={\zihao{-5}},
},
minor tick num=1,
tick pos=left,
tick align=outside,
tick style={thin,black},
]
\addplot [only marks,mark=square*]
table [x={radial}, y={energy}, col sep=comma]
{./assets/energy-distrib.csv};
\node at (2,6000)
{$q_{v}=\dfrac{\sigma\omega^{2}|\mathbf{A}|^{2}}{2}$};
\end{axis}
\end{tikzpicture}
\bicaption{内热源沿径向的分布}{Energy distribution along radial}
\label{fig:energy-distrib}
\end{figure}

\subsection{多个图形}
Expand Down
Binary file removed figures/cn_100t.png
Binary file not shown.
9 changes: 0 additions & 9 deletions refs.bib
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,4 @@ @standard{GBT16159
year = {1996}
}

@article{He1999,
author = {何闻},
title = {标准动态力发生装置国内外研究现状},
journal = {机电工程},
year = {1999},
number = {2},
pages = {47--49}
}

@Comment{jabref-meta: databaseType:biblatex;}
4 changes: 4 additions & 0 deletions setup.tex
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@
\usepackage{tikz}
\usetikzlibrary{arrows.meta, shapes.geometric}

% 数据图表宏包
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

% 一些文档中用到的 logo
\usepackage{hologo}
\providecommand{\XeTeX}{\hologo{XeTeX}}
Expand Down

0 comments on commit 0eff217

Please sign in to comment.