Team Ai
Datasetpublic

ajayvikram/matplotlib-code-image

Matplotlib Code-Image Pairs Dataset Summary This dataset contains static Matplotlib figure images paired with the Python source code that generated them. It was built from the official Matplotlib gallery and excludes animation-style examples. Each row corresponds to one rendered image. Examples that produce multiple figures contribute multiple rows. Dataset Composition Image/code rows: 643 Source examples: 452 Examples with multiple figures: 74… See the full description on the dataset page: https://huggingface.co/datasets/ajayvikram/matplotlib-code-image.

sourceHugging Faceotherupdated 7mo agoView on Hugging Face
0likes16downloads
README.md92 linesDownload Raw Back to root
1---2pretty_name: Matplotlib Code-Image Pairs3license: other4license_name: matplotlib-license5license_link: https://matplotlib.org/stable/project/license.html6tags:7- matplotlib8- code9- plotting10- computer-vision11- synthetic12---13 14# Matplotlib Code-Image Pairs15 16## Dataset Summary17 18This dataset contains static Matplotlib figure images paired with the Python source code that generated them.19It was built from the official Matplotlib gallery and excludes animation-style examples.20Each row corresponds to one rendered image. Examples that produce multiple figures contribute multiple rows.21 22## Dataset Composition23 24- Image/code rows: 64325- Source examples: 45226- Examples with multiple figures: 7427- Included statuses: ok28- Source gallery: https://matplotlib.org/stable/gallery/index.html29 30## Top Categories31 32- `lines_bars_and_markers`: 48 examples33- `images_contours_and_fields`: 47 examples34- `text_labels_and_annotations`: 46 examples35- `mplot3d`: 44 examples36- `subplots_axes_and_figures`: 35 examples37- `misc`: 25 examples38- `ticks`: 24 examples39- `axes_grid1`: 22 examples40- `statistics`: 21 examples41- `event_handling`: 20 examples42 43## Row Schema44 45- `image`: rendered PNG for one figure46- `code`: full Python source for the example47- `example_id`: stable identifier derived from the Matplotlib gallery URL48- `figure_index`: zero-based figure index within the example49- `figure_name`: original rendered image filename50- `title`: example page title51- `example_page_url`: Matplotlib gallery page URL52- `source_url`: downloadable Python source URL when available53- `source_relpath`: source filename reported by the scraper54- `category_hint`: rough gallery category inferred from the URL path55- `status`: scraper/render status kept for provenance56- `num_figures`: number of figures reported for the source example57- `error`: render or scrape error text, usually null for successful rows58 59## Build Process60 611. Crawl the official Matplotlib gallery.622. Download the Python source for each example page.633. Render examples with Matplotlib's non-interactive `Agg` backend.644. Keep static rendered image/code pairs and skip dynamic animation-style examples.655. Export one dataset row per rendered image.66 67## Usage68 69Load the local saved dataset:70 71```python72from datasets import load_from_disk73 74ds = load_from_disk("/usr/project/xtmp/ap843/hf_datasets/matplotlib_code_image_pairs")["train"]75```76 77Load from the Hugging Face Hub after pushing:78 79```python80from datasets import load_dataset81 82ds = load_dataset("ajayvikram/matplotlib-code-image", split="train")83```84 85## License And Attribution86 87This dataset is derived from Matplotlib gallery examples. The card metadata uses `license: other` with88`license_name: matplotlib-license` and `license_link: https://matplotlib.org/stable/project/license.html` because the Matplotlib project uses a89project-specific license rather than a standard Hugging Face license identifier. The official Matplotlib license90permits use, distribution, and derivative works provided the Matplotlib copyright notice and license agreement91are retained. This is an interpretation of the official license page, not legal advice.92