带有自定义网格和刻度的图表

带有自定义网格和刻度的图表

Latex 用户,

我想创建一组填充细网格的轴,适合绘制图形,如下图所示。我还想在 x 轴和 y 轴上放置标签。

我想要的是

但是使用代码时,x 刻度和 y 刻度与网格不对齐。

\documentclass[]{article}
\usepackage[margin=0.5in]{geometry}
\usepackage{pgfplots}
\usepackage{mathtools}
\usepackage{cancel}
\usepackage{pgfplots}
\usepackage{amsmath}
\newtheorem{theorem}{THEOREM}
\newtheorem{proof}{PROOF}
\usepackage{tikz}
\usepackage{amssymb}
\usetikzlibrary{patterns}
\usepackage{fancyheadings}
\usepackage{bigints}
\usepackage{color}
\usepackage{tcolorbox}
\usepackage{booktabs,array}
\usepackage{hyperref}
\usepgfplotslibrary{fillbetween}
\begin{document}
\setlength{\parindent}{0cm}
%\pagecolor{blue!13}
\fancyhf{}
\fancyhead[C]{\thepage}
\voffset = 0.1cm
\pagestyle{fancy}
\definecolor{web}{RGB}{56, 102, 166}
\setlength{\parindent}{0mm}
\setcounter{page}{1}
\begin{tikzpicture}
\begin{axis}[
axis lines=middle,
%grid=major,
xmin=-0.3,
xmax=10.8,
ymin=-0.6,
ymax=10.8,
height=9cm,
width=12cm,
%xtick={0,1.2,...,9.6,12},
%xticklabel={0,1,...,8,10},
%ytick={0,1,...,9,10},
%tick style = {line width = 0.1pt},
%tick style={very thick},
%tick style={very thick},
%enlargelimits=false,
%grid=both,
%axis line style={shorten >=-10pt, shorten <=-10pt},
%xlabel style={
%   anchor=west,
%   at={(ticklabel* cs:1.0)},
%   xshift=10pt
%},
%xlabel=\text{NZD(\$)},
xtick={0,1.265,2.53,3.795,5.06,6.325,7.59,8.855,10.12,11.385,12.65},
xticklabels={$0$,$1$,$2$,$3$,$4$,$5$,$6$,$7$,$8$,$9$,$10$}
%ylabel style={
%   anchor=south,
%   at={(ticklabel* cs:1.0)},
%   yshift=10pt
%},
%ylabel=\text{AUD}(\$),
]
\draw[step=0.245cm,gray!50,very thin,opacity=0.9] (axis cs: 0,0) grid (axis cs: 10,10);
%\addplot[ultra thick,samples=100,domain=0:1] {0};
\node at (axis cs: -0.15, -0.3) {$O$};
\end{axis}
\end{tikzpicture}
\end{document}

这是代码生成的图表:

错误的图表

您能否建议任何修改以便我获得所需的输出?

非常感谢

相关内容