Below I have 4 subfigures, but I have a problem if the third subfigure text exceeded one line, the 4th figure will shift down a little bit as you see below. Not sure how to fix this please?
\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
% The preceding line is only needed to identify funding in the first footnote. If that is unneeded, please comment it out.
\usepackage{cite}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{xcolor}
\usepackage{tabularx}
\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}
\title{AlgorithmTemplate}
% \documentclass[12pt]{article}
\usepackage{fullpage}
\usepackage{times}
\usepackage{fancyhdr}
\usepackage[ruled,vlined]{algorithm2e}
\include{pythonlisting}
\begin{document}
sa
\begin{figure}
\centering
\begin{subfigure}[b]{0.45\linewidth}
\centering
\includegraphics[width=\linewidth]{testfig.png}
\caption{a}
\label{fig: a}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.45\linewidth}
\centering
\includegraphics[width=\linewidth]{testfig.png}
\caption{b }
\label{fig:b}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.45\linewidth}
\centering
\includegraphics[width=\linewidth]{testfig.png}
\caption{I have some text here that will shift the 4th figure to bottom}
\label{fig:c}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.45\linewidth}
\centering
\includegraphics[width=\linewidth]{testfig.png}
\caption{d}
\label{fig:d}
\end{subfigure}
\caption{d}
\label{fig:three graphs}
\end{figure}
\end{document}


[b]s to[t]atsubfigures. Also, remove the middle\hfilland leave an empty space. This will create a new paragraph and move other two figures to the next line. You might need to add an extra vertical space, e.g.\bigskipor\vspace{v-sep}, where vsep could any length s.a. 12pt, 1cm etc. – Celdor Oct 30 '22 at 19:04\hfill\llap{\rule{\textwdith}{0.4pt}}to show the baseline location. – John Kormylo Oct 30 '22 at 20:34Undefined control sequence. \hfill\llap{\rule{\textwdith}{0.4pt}}. Where I should add this please? Should I add it just before\end{figure}? – Avv Oct 31 '22 at 12:44