我开始学习 LaTex,今天开始学习 tikz。但我遇到了一个问题,我希望这不是太愚蠢的问题。我(几乎)完成了我的图形,现在我想创建一个部分。我已将该部分放在我的 tikz 环境上方,但即便如此,它仍显示在 pdf 中的图形下方……我该如何解决这个问题?
我的代码
\documentclass[]{article}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{cancel}
\usepackage{xcolor}
\usepackage[a4paper, total={6in, 9in}]{geometry}
%opening
\title{}
\author{}
\begin{document}
\section*{\LARGE Deriving; $y(t)=\hat{y}\cdot\sin(\omega t)$} %How do i get this up
hello
\begin{figure}
\begin{center}
\begin{tikzpicture}
\definecolor{circlecol}{HTML}{004AAD}
\definecolor{xaxis}{HTML}{8C52FF}
\definecolor{anglecon}{HTML}{6C0EAD}
\definecolor{yaxis}{HTML}{FF66C4}
\definecolor{hypo}{HTML}{38B6FF}
\draw [lightgray, dashed](0,-2) -- (0,2);
\draw [lightgray, dashed](-2,0) -- (2,0);
\draw [<->](2,0) -- (7.5,0) node [below] {$t$};
\draw [<->](2.25,-2) -- (2.25,2) node [left]{$y$};
\fill [hypo](0,0) -- (0.4,0) arc [start angle=0, end angle=40, radius=0.4] -- cycle;
\draw[line width=0.35mm, yaxis] (1.532,0) -- (1.532, 1.286)node[left, midway] {$y$};
\draw[line width=0.35mm, hypo] (0,0) -- (1.532, 1.286) node [left, midway] {$\hat{y}$};
\draw [line width=0.35mm, xaxis](0,0) -- (1.547,0) node [below, midway] {$\Delta t$};
\draw [line width=0.25mm, circlecol](0,0) circle [radius=2];
\fill [circlecol] (0,0) circle [radius=0.03];
\draw[->, yaxis, dashed] (1.532, 1.286) -- (7.5, 1.286);
\draw[circlecol] (2.25,0) sin (3,2) cos (3.75,0) sin (4.5,-2) cos (5.25, 0) sin(6,2) cos(6.75, 0) sin(7.5,-2);
\foreach \x in {3,3.75,...,6.75}\draw (\x,0.05) -- (\x,-0.05);
\foreach \y in {-1.5, -1,...,1.5}\draw (2.2,\y) -- (2.3,\y);
\end{tikzpicture}
\end{center}
\caption{Harmonic Oscillator}
\end{figure}
\end{document}