I ploted a big figure with several subfigures in it using matplotlib, because the library provides many features that are difficult to implement in tex (like shared label and shared axis). However, I would like to \ref these subfigures just like subcaption in tex. Is there any methods can do the trick?

My requirement is nearly the same as the question in Several labels for big figure with included subplots.

However, the solution does not work when hyperref is imported. Since the answer is posted 3 years ago and it seems that it would not get any updates, I asked the question again.

1 Answer 1


I figured out a work around:



Figure~\ref{fig:a} consists of sub-figure~\ref{fig:a:left_plot},
sub-figure~\ref{fig:a:right_plot}, and
sub-figure~\ref{fig:a:somewhere else}.
  \caption{This plot has three parts.}\label{fig:a}
  \phantomlabel{c}{fig:a:somewhere else}

Figure~\ref{fig:b} consists of sub-figure~\ref{fig:b:left_plot},
sub-figure~\ref{fig:b:right_plot}, and
sub-figure~\ref{fig:b:somewhere else}.
  \caption{This plot has three parts.}\label{fig:b}
  \phantomlabel{c}{fig:b:somewhere else}

The code is modified from the answer posted by @gernot in the question I linked. The basic idea is to create a hyper-target in the corresponding phantom label position without writing text.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .