遇见数据集

ajayvikram/matplotlib-code-image

收藏
Hugging Face2026-03-24 更新2026-03-29 收录
官方服务:

资源简介:

--- pretty_name: Matplotlib Code-Image Pairs license: other license_name: matplotlib-license license_link: https://matplotlib.org/stable/project/license.html tags: - matplotlib - code - plotting - computer-vision - synthetic --- # 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 - Included statuses: ok - Source gallery: https://matplotlib.org/stable/gallery/index.html ## Top Categories - `lines_bars_and_markers`: 48 examples - `images_contours_and_fields`: 47 examples - `text_labels_and_annotations`: 46 examples - `mplot3d`: 44 examples - `subplots_axes_and_figures`: 35 examples - `misc`: 25 examples - `ticks`: 24 examples - `axes_grid1`: 22 examples - `statistics`: 21 examples - `event_handling`: 20 examples ## Row Schema - `image`: rendered PNG for one figure - `code`: full Python source for the example - `example_id`: stable identifier derived from the Matplotlib gallery URL - `figure_index`: zero-based figure index within the example - `figure_name`: original rendered image filename - `title`: example page title - `example_page_url`: Matplotlib gallery page URL - `source_url`: downloadable Python source URL when available - `source_relpath`: source filename reported by the scraper - `category_hint`: rough gallery category inferred from the URL path - `status`: scraper/render status kept for provenance - `num_figures`: number of figures reported for the source example - `error`: render or scrape error text, usually null for successful rows ## Build Process 1. Crawl the official Matplotlib gallery. 2. Download the Python source for each example page. 3. Render examples with Matplotlib's non-interactive `Agg` backend. 4. Keep static rendered image/code pairs and skip dynamic animation-style examples. 5. Export one dataset row per rendered image. ## Usage Load the local saved dataset: ```python from datasets import load_from_disk ds = load_from_disk("/usr/project/xtmp/ap843/hf_datasets/matplotlib_code_image_pairs")["train"] ``` Load from the Hugging Face Hub after pushing: ```python from datasets import load_dataset ds = load_dataset("ajayvikram/matplotlib-code-image", split="train") ``` ## License And Attribution This dataset is derived from Matplotlib gallery examples. The card metadata uses `license: other` with `license_name: matplotlib-license` and `license_link: https://matplotlib.org/stable/project/license.html` because the Matplotlib project uses a project-specific license rather than a standard Hugging Face license identifier. The official Matplotlib license permits use, distribution, and derivative works provided the Matplotlib copyright notice and license agreement are retained. This is an interpretation of the official license page, not legal advice.

--- 数据集名称:Matplotlib 代码-图像对 许可证:其他 许可证名称:matplotlib-license 许可证链接:https://matplotlib.org/stable/project/license.html 标签: - Matplotlib绘图库 - 代码 - 绘图 - 计算机视觉 - 合成数据 --- # Matplotlib 代码-图像对数据集 ## 数据集概述 本数据集包含静态Matplotlib绘图图像与其生成所用的Python源代码的配对样本。该数据集源自官方Matplotlib图库,且排除了动画类示例。每一行对应一张渲染后的图像,若某个示例可生成多张图像,则会对应多行数据。 ## 数据集构成 - 图像/代码对行数:643 - 源示例数量:452 - 含多幅图像的示例数:74 - 包含状态:正常 - 源图库地址:https://matplotlib.org/stable/gallery/index.html ## 热门分类 - `lines_bars_and_markers`: 折线图、柱状图与标记绘图:48个示例 - `images_contours_and_fields`: 图像、等高线与场图:47个示例 - `text_labels_and_annotations`: 文本标签与注释:46个示例 - `mplot3d`: 3D绘图(mplot3d):44个示例 - `subplots_axes_and_figures`: 子图、轴与图像:35个示例 - `misc`: 其他:25个示例 - `ticks`: 刻度设置:24个示例 - `axes_grid1`: 轴网格1:22个示例 - `statistics`: 统计绘图:21个示例 - `event_handling`: 事件处理:20个示例 ## 行数据模式 - `image`: 单幅图像的渲染后PNG文件 - `code`: 该示例的完整Python源代码 - `example_id`: 源自Matplotlib图库URL的稳定标识符 - `figure_index`: 该示例内从零开始计数的图像索引 - `figure_name`: 原始渲染图像的文件名 - `title`: 示例页面的标题 - `example_page_url`: Matplotlib图库对应页面的URL - `source_url`: 可下载的Python源代码URL(若可用) - `source_relpath`: 爬虫抓取到的源文件名 - `category_hint`: 从URL路径推断出的粗略图库分类 - `status`: 用于溯源的爬虫/渲染状态 - `num_figures`: 源示例报告的图像总数 - `error`: 渲染或抓取的错误文本,成功的行通常为null ## 构建流程 1. 爬取官方Matplotlib图库 2. 下载每个示例页面的Python源代码 3. 使用Matplotlib的非交互式Agg后端渲染示例 4. 保留静态渲染的图像-代码配对样本,跳过动态动画类示例 5. 为每幅渲染后的图像导出一条数据集行 ## 使用方法 加载本地保存的数据集: python from datasets import load_from_disk ds = load_from_disk("/usr/project/xtmp/ap843/hf_datasets/matplotlib_code_image_pairs")["train"] 从Hugging Face Hub加载(推送后): python from datasets import load_dataset ds = load_dataset("ajayvikram/matplotlib-code-image", split="train") ## 许可与归因 本数据集源自Matplotlib图库示例。本数据集卡片元数据使用`license: other`,并指定`license_name: matplotlib-license`与`license_link: https://matplotlib.org/stable/project/license.html`,原因是Matplotlib项目使用专属项目许可证,而非标准的Hugging Face许可证标识符。官方Matplotlib许可证允许使用、分发及创作衍生作品,但需保留Matplotlib版权声明与许可协议。此处为对官方许可证页面的解读,并非法律建议。

提供机构:
ajayvikram
二维码
社区交流群
二维码
科研交流群
商业服务