Giter Site home page Giter Site logo

plot-clutter's Introduction

Demo of output cluttering by Matplotlib plot directive

Matplotlib plot directive in some cases copies unnecessary files to the output directory, and in some cases the necessary files are not copied. This is a minimal working example for issue #24005.

Steps to reproduce:

  1. Stray files in a “clean” build:

    a. Run make clean, just in case, to ensure a clean build. b. Run make singleghtml to produce a “single HTML” build. c. Inspect the output directory build/singleghtml — in addition to the necessary file index.html and the _static and _images directories (the latter contains all the necessary images used in index.html), there are also absolutely unnecessary and unreferenced SVG and PDF files directly and inside the absolutely unnecessary and unreferenced subdirectory subdir.

  2. No stray files when reusing another build:

    a. Run make clean to clean the previous build results. b. Run make html to produce a regular “HTML” build in build/html. The output also has the same unnecessary and unreferenced files, as above, but this is not the point. c. Run make singleghtml to produce a “single HTML” build, which will reuse the images already produced by the previous build. d. Inspect the output directory build/singleghtml — now it looks as expected, without any unnecessary and unreferenced SVG and PDF files and subdirectories (all used images are properly inside _images).

  3. Needed files are not copied when reusing another build:

    a. Comment out plot_html_show_formats = False (and plot_html_show_source_link = False) in conf.py to enable automatic links to image formats (and plotting scripts). b. Run make clean to clean the previous build results. c. Run make html to produce a regular “HTML” build in build/html. The output has all the necessary files that are linked from the HTML, as expected. d. Run make singleghtml to produce a “single HTML” build, which will reuse the images (and scripts) already produced by the previous build. e. Inspect the output directory build/singleghtml — it doesn't have any image (and script) files, resulting in broken links to “(Source code, svg, pdf)” for all the plots in the HTML file.

  4. Links with wrong subdirectory paths in singleghtml build:

    a. Use the modified conf.py from the previous build. b. Run make clean to clean the previous build results. c. Run make singleghtml to produce a “single HTML” build, which should include links to scripts and image formats. d. Inspect the output directory and confirm that build/singleghtml/subdir contains {other-1,script}.{py,pdf,svg} files. e. Open the generated HTML file build/singleghtml/index.html and try using the “(Source code, svg, pdf)” links in the “Other” section. None of them works because they all refer to ../subdir/<file> (resolving to build/subdir/<file>) instead of subdir/<file> (correct path relative to index.html, resolving to build/singleghtml/subdir/<file>).

plot-clutter's People

Contributors

mikhailryazanov avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.