Closed
Description
There is a change of figure numbering. Before it was based on the matplotlib figure number now it is 1,2, ..., number_of_figures
.
This is a small change that was spotted in scikit-learn doc (scikit-learn/scikit-learn#13513), because:
- in the example .py file, we use
plt.figure(0)
- in the rst we include the figure with
.. figure:: ../auto_examples/gaussian_process/images/sphx_glr_plot_gpc_000.png
This can be fixed easily inside scikit-learn and I am not sure whether sphinx-gallery should do something about it. It is kind of a edge case that is not that likely to happen in practice. Maybe this could be documented it in CHANGES.rst?
Here is an example to reproduce the problem:
examples/plot_exp_test.py:
(it is just examples/plot_exp.py
with explicit matplotlib figure numbers)
# -*- coding: utf-8 -*-
"""
Plotting the exponential function
=================================
A simple example for ploting two figures of a exponential
function in order to test the autonomy of the gallery
stacking multiple images.
"""
# Code source: Óscar Nájera
# License: BSD 3 clause
import numpy as np
import matplotlib.pyplot as plt
def main():
x = np.linspace(-1, 2, 100)
y = np.exp(x)
plt.figure(0)
plt.plot(x, y)
plt.xlabel('$x$')
plt.ylabel('$\exp(x)$')
plt.figure(4)
plt.plot(x, -np.exp(-x))
plt.xlabel('$x$')
plt.ylabel('$-\exp(-x)$')
plt.show()
if __name__ == '__main__':
main()
cd doc
make clean html
ls -1 auto_examples/images/sphx_glr_plot_exp_test_*
Output on 0.2.0:
auto_examples/images/sphx_glr_plot_exp_test_000.png
auto_examples/images/sphx_glr_plot_exp_test_004.png
Output on 0.3.1:
auto_examples/images/sphx_glr_plot_exp_test_001.png
auto_examples/images/sphx_glr_plot_exp_test_002.png
Metadata
Metadata
Assignees
Labels
No labels