ajayvikram commited on
Commit
6776d0e
·
verified ·
1 Parent(s): 1c14d3f

Add dataset card

Browse files
Files changed (1) hide show
  1. README.md +85 -39
README.md CHANGED
@@ -1,41 +1,87 @@
1
  ---
2
- dataset_info:
3
- features:
4
- - name: image
5
- dtype: image
6
- - name: code
7
- dtype: string
8
- - name: example_id
9
- dtype: string
10
- - name: figure_index
11
- dtype: int64
12
- - name: figure_name
13
- dtype: string
14
- - name: title
15
- dtype: string
16
- - name: example_page_url
17
- dtype: string
18
- - name: source_url
19
- dtype: string
20
- - name: source_relpath
21
- dtype: string
22
- - name: category_hint
23
- dtype: string
24
- - name: status
25
- dtype: string
26
- - name: num_figures
27
- dtype: int64
28
- - name: error
29
- dtype: 'null'
30
- splits:
31
- - name: train
32
- num_bytes: 57044107
33
- num_examples: 643
34
- download_size: 54960557
35
- dataset_size: 57044107
36
- configs:
37
- - config_name: default
38
- data_files:
39
- - split: train
40
- path: data/train-*
41
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ pretty_name: Matplotlib Code-Image Pairs
3
+ license: other
4
+ tags:
5
+ - matplotlib
6
+ - code
7
+ - plotting
8
+ - computer-vision
9
+ - synthetic
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  ---
11
+
12
+ # Matplotlib Code-Image Pairs
13
+
14
+ ## Dataset Summary
15
+
16
+ This dataset contains static Matplotlib figure images paired with the Python source code that generated them.
17
+ It was built from the official Matplotlib gallery and excludes animation-style examples.
18
+ Each row corresponds to one rendered image. Examples that produce multiple figures contribute multiple rows.
19
+
20
+ ## Dataset Composition
21
+
22
+ - Image/code rows: 643
23
+ - Source examples: 452
24
+ - Examples with multiple figures: 74
25
+ - Included statuses: ok
26
+ - Source gallery: https://matplotlib.org/stable/gallery/index.html
27
+
28
+ ## Top Categories
29
+
30
+ - `lines_bars_and_markers`: 48 examples
31
+ - `images_contours_and_fields`: 47 examples
32
+ - `text_labels_and_annotations`: 46 examples
33
+ - `mplot3d`: 44 examples
34
+ - `subplots_axes_and_figures`: 35 examples
35
+ - `misc`: 25 examples
36
+ - `ticks`: 24 examples
37
+ - `axes_grid1`: 22 examples
38
+ - `statistics`: 21 examples
39
+ - `event_handling`: 20 examples
40
+
41
+ ## Row Schema
42
+
43
+ - `image`: rendered PNG for one figure
44
+ - `code`: full Python source for the example
45
+ - `example_id`: stable identifier derived from the Matplotlib gallery URL
46
+ - `figure_index`: zero-based figure index within the example
47
+ - `figure_name`: original rendered image filename
48
+ - `title`: example page title
49
+ - `example_page_url`: Matplotlib gallery page URL
50
+ - `source_url`: downloadable Python source URL when available
51
+ - `source_relpath`: source filename reported by the scraper
52
+ - `category_hint`: rough gallery category inferred from the URL path
53
+ - `status`: scraper/render status kept for provenance
54
+ - `num_figures`: number of figures reported for the source example
55
+ - `error`: render or scrape error text, usually null for successful rows
56
+
57
+ ## Build Process
58
+
59
+ 1. Crawl the official Matplotlib gallery.
60
+ 2. Download the Python source for each example page.
61
+ 3. Render examples with Matplotlib's non-interactive `Agg` backend.
62
+ 4. Keep static rendered image/code pairs and skip dynamic animation-style examples.
63
+ 5. Export one dataset row per rendered image.
64
+
65
+ ## Usage
66
+
67
+ Load the local saved dataset:
68
+
69
+ ```python
70
+ from datasets import load_from_disk
71
+
72
+ ds = load_from_disk("/usr/project/xtmp/ap843/hf_datasets/matplotlib_code_image_pairs")["train"]
73
+ ```
74
+
75
+ Load from the Hugging Face Hub after pushing:
76
+
77
+ ```python
78
+ from datasets import load_dataset
79
+
80
+ ds = load_dataset("ajayvikram/matplotlib-code-image", split="train")
81
+ ```
82
+
83
+ ## License And Attribution
84
+
85
+ This dataset is derived from Matplotlib gallery examples. The dataset card uses `license: other` by default,
86
+ but you should verify the correct redistribution requirements before publishing publicly and retain appropriate
87
+ Matplotlib attribution and license notices.