8000 referencing a plot_directive plot does not work · Issue #9346 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
referencing a plot_directive plot does not work #9346
Closed as not planned
Closed as not planned
@quantenschaum

Description

@quantenschaum

Bug report

Bug summary

A figure created with plot_directive and preceeding label cannot be referenced with :ref: or :numref:.

Code for reproduction

.. _bar:

Testplot
--------

.. _foo:

.. plot::

   import matplotlib.pyplot as plt
   import numpy as np
   plt.hist(np.random.randn(1000), 20)

reference to plot: :ref:`foo` / :numref:`foo`
	
reference to section: :ref:`bar` / :numref:`bar`

Actual outcome

rendered HTML

bildschirmfoto_2017-10-10_18-42-44

LaTeX code

\subsection{Testplot}
\label{\detokenize{M01/index:testplot}}\label{\detokenize{M01/index:bar}}\phantomsection\label{\detokenize{M01/index:foo}}
\begin{figure}[H]
\centering

\noindent\sphinxincludegraphics{{index-1}.pdf}
\end{figure}

reference to plot: \DUrole{xref,std,std-ref}{foo} / \sphinxcode{foo}

reference to section: {\hyperref[\detokenize{M01/index:bar}]{\sphinxcrossref{\DUrole{std,std-ref}{Testplot}}}} / \hyperref[\detokenize{M01/index:bar}]{Section \ref{\detokenize{M01/index:bar}}}

Expected outcome

The foo references should be links like the bar references.

Matplotlib version

  • Operating system: Linux 4.10.0-35-generic 39~16.04.1-Ubuntu 16.04.3 LTS SMP x86_64 GNU/Linux
  • Matplotlib version: 2.1.0 via pip
  • Python version: 3.5.2
  • Other libraries: Sphinx (sphinx-build) 1.6.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: closed as inactiveIssues closed by the "Stale" Github Action. Please comment on any you think should still be open.status: inactiveMarked by the “Stale” Github Actiontopic: sphinx extension

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0