我喜欢用十进制 0.01、0.02、0.03、.. 0.10 来显示数字,而不是用科学计数法。这可能吗?
另外,我并不是想添加第二个问题,但每次我尝试添加趋势线时,它都不起作用。任何有关这方面的建议也非常感谢。
\documentclass{article}
\usepackage[letterpaper, portrait, margin=2cm]{geometry}
\usepackage[english]{babel}
\usepackage[protrusion=true,expansion=true]{microtype}
\usepackage{amsmath,amsfonts,amsthm,amssymb}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{colortbl}
\usepackage[svgnames,table,xcdraw,dvipsnames]{xcolor}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{array}
\usepackage{pgfplots}
\usepackage{booktabs}
\usepackage{cellspace}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[svgnames,table,xcdraw,dvipsnames]{xcolor}
\usepackage[version=3]{mhchem}
\usepackage{chemfig}
\usepackage{gensymb}
\usepackage[most]{tcolorbox}
\usepackage{xparse}
\usepackage{tikz}
\usepackage{makecell}
\usepackage{floatflt}
\usepackage{wrapfig}
\usepackage{fancyhdr}
\usepackage{epstopdf}
\usetikzlibrary{calc,shadings,patterns}
\pagenumbering{roman}
.. 剪辑
\begin{center}
\includegraphics[scale=0.75]{exp24_fig2.eps}
\end{center}
\section*{Results}
\noindent
\begin{tabular}{@{}cc@{}}
\begin{tikzpicture}[baseline=(current bounding box.center)]
\begin{axis}[
title={Ballistic Galvanometer Calibration},
xlabel={Capacitance ($\mu$F)},
ylabel={Deflectance (cm)},
xmin=0.01, xmax=0.10,
ymin=2, ymax=17,
legend pos=north west,
ymajorgrids=true,
xmajorgrids=true,
yminorgrids=true,
xminorgrids=true,
grid style=dashed,
]
\addplot[
color=blue,
mark=square,
]
coordinates {
(0.01,2)(0.02,4)(0.03,5)(0.04,7)(0.05,8)(0.06,10)(0.07,12)(0.08,13)(0.09,15) (0.10,17)
};
\end{axis}
\end{tikzpicture}
答案1
您必须使用 xtick 标签样式来获取所需的格式或覆盖所选样式。示例位于 pgfplots 手册第 23 页。以下代码为您提供所需的输出:
\documentclass[x11names,svgnames,11pt]{article}
%
\usepackage{pgfplots}
\pgfplotsset{compat=1.13}
\begin{document}
\begin{tikzpicture}[baseline=(current bounding box.center)]
\begin{axis}[
title={Ballistic Galvanometer Calibration},
xlabel={Capacitance ($\mu$F)},
ylabel={Deflectance (cm)},
xmin=0, xmax=0.12,
xticklabel style={
/pgf/number format/precision=3,
/pgf/number format/fixed},
legend pos=north west,
ymajorgrids=true,
xmajorgrids=true,
yminorgrids=true,
xminorgrids=true,
grid style=dashed,
]
\addplot[only marks, color=blue, mark=square]
coordinates {
(0.01,2)
(0.02,4)
(0.03,5)
(0.04,7)
(0.05,8)
(0.06,10)
(0.07,12)
(0.08,13)
(0.09,15)
(0.10,17)
};
\addplot[no marks] {163*x+0.3333 } ;
\end{axis}
\end{tikzpicture}
\end{document}