How to give floats/figures titles?

The {figure} environment isn't limited to contain only figures etc. You can add anything so just type in your title above the figure.

manually

\begin{figure}
    \centering
    \textbf{Your title}\par\medskip
    \includegraphics[scale=0.3]{example-image}
    \caption{Your caption}
\end{figure}

You can define a new command like \figuretitle to make the formatting and spacing consistent.

\newcommand*{\figuretitle}[1]{%
    {\centering%   <--------  will only affect the title because of the grouping (by the
    \textbf{#1}%              braces before \centering and behind \medskip). If you remove
    \par\medskip}%            these braces the whole body of a {figure} env will be centered.
}

Looks the same as above, but can be used as

\begin{figure}
    \centering
    \figuretitle{Your title}
    \includegraphics[scale=0.3]{example-image}
    \caption{Your caption}
\end{figure}

Or you can use the \caption above the figure. In this case you may use the caption package to adjust the spacing.

caption above

\documentclass{article}

\usepackage{graphicx}

\usepackage{caption}
\captionsetup[figure]{
    position=above,
}

\begin{document}
\begin{figure}
    \centering
    \caption{Your caption}
    \includegraphics[scale=0.3]{example-image}
\end{figure}
\end{document}

You could try making the matplotlib text look like LaTeX:

%matplotlib inline
from matplotlib import pyplot as plt

# This is the first important line:
from matplotlib import rcParams

plt.plot([1, 2, 3, 4], 
         [2, 4, 6, 8])

# These are the second and third important lines:
plt.rc('text', usetex=True)
plt.rc('font', family='serif')

# Change the fontsize to match your document.
plt.xlabel("This is a cool label.", fontsize=12)
plt.ylabel("This is another cool label.", fontsize=12)
plt.savefig("image.pdf", dpi=200)

LaTeX Style Fonts from matplotlib!


An alternative method is to output from Matplotlib as .svg, with or without a title then read in to Inkscape. You can save from Inkscape as .pdf+.tex (or .eps+.tex I think), where the .pdf(.eps) contains the graphics, and the .tex overlays the text, in your current document font. All this can be done from the command line - Inkscape supports that.

A couple of links:

Setting up matplotlib to output text as text

Adjusting sizing of figure and text