{"id":13608085,"url":"https://github.com/altair-viz/pdvega","last_synced_at":"2025-10-21T19:46:45.733Z","repository":{"id":57451549,"uuid":"117155928","full_name":"altair-viz/pdvega","owner":"altair-viz","description":"Interactive plotting for Pandas using Vega-Lite","archived":true,"fork":false,"pushed_at":"2019-03-29T16:09:14.000Z","size":9480,"stargazers_count":344,"open_issues_count":17,"forks_count":30,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-03-20T13:05:39.439Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://altair-viz.github.io/pdvega/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/altair-viz.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-11T21:30:27.000Z","updated_at":"2024-05-17T15:22:42.000Z","dependencies_parsed_at":"2022-09-04T10:41:01.383Z","dependency_job_id":null,"html_url":"https://github.com/altair-viz/pdvega","commit_stats":null,"previous_names":["jakevdp/pdvega"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/altair-viz%2Fpdvega","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/altair-viz%2Fpdvega/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/altair-viz%2Fpdvega/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/altair-viz%2Fpdvega/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/altair-viz","download_url":"https://codeload.github.com/altair-viz/pdvega/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248581257,"owners_count":21128137,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T19:01:24.106Z","updated_at":"2025-10-21T19:46:45.325Z","avatar_url":"https://github.com/altair-viz.png","language":"Python","funding_links":[],"categories":["Python","数据可视化","Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# ``pdvega``: Vega-Lite plotting for Pandas Dataframes\n\n[![build status](http://img.shields.io/travis/altair-viz/pdvega/master.svg?style=flat)](https://travis-ci.org/altair-viz/pdvega)\n[![Binder](https://mybinder.org/badge.svg)](https://mybinder.org/v2/gh/altair-viz/pdvega/master?filepath=examples%2Fpdvega_example.ipynb)\n\n``pdvega`` is a library that allows you to quickly create interactive\n[Vega-Lite](https://vega.github.io/vega-lite/) plots from Pandas dataframes,\nusing an API that is nearly identical to Pandas' built-in\n[visualization tools](https://pandas.pydata.org/pandas-docs/stable/visualization.html), and designed for easy use within the [Jupyter notebook](http://jupyter.org).\n\n- [Full Documentation](http://altair-viz.github.io/pdvega/)\n\nPandas currently has some basic plotting capabilities based on\n[matplotlib](http://matplotlib.org). So, for example, you can create\na scatter plot this way:\n\n```python\nimport numpy as np\nimport pandas as pd\n\ndf = pd.DataFrame({'x': np.random.randn(100), 'y': np.random.randn(100)})\ndf.plot.scatter(x='x', y='y')\n```\n\n![matplotlib scatter output](images/mpl-scatter.png?raw=true)\n\nThe goal of ``pdvega`` is that any time you use ``dataframe.plot``, you'll be\nable to replace it with ``dataframe.vgplot`` and instead get a similar\n(but prettier and more interactive) visualization output in Vega-Lite that you can easily export to share or customize:\n\n```python\nimport pdvega  # import adds vgplot attribute to pandas\n\ndf.vgplot.scatter(x='x', y='y')\n```\n\n![vega-lite scatter output](images/vg-scatter.png?raw=true)\n\nThe above image is a static screenshot of the interactive output; please see the\n[Documentation](http://altair-viz.github.io/pdvega/) for a full set of live\nusage examples.\n\n## Installation\n\nYou can get started with ``pdvega`` using pip:\n\n```\n$ pip install jupyter pdvega\n$ jupyter nbextension install --sys-prefix --py vega3\n```\n\nThe first line installs ``pdvega`` and its dependencies; the second installs\nthe Jupyter extensions that allows plots to be displayed in the Jupyter\nnotebook. For more information on installation and dependencies, see the\n[Installation docs](https://altair-viz.github.io/pdvega/installation.html).\n\n## Why Vega-Lite?\nWhen working with data, one of the biggest challenges is ensuring reproducibility of results.\nWhen you create a figure and export it to PNG or PDF, the data become baked-in to the rendering in a\nway that is difficult or impossible for others to extract. [Vega](http://vega.github.io/vega) and\n[Vega-Lite](http://vega.github.io/vega-lite) change this: instead of packaging a figure by encoding its\npixel values, they package a figure by describing, in a declarative manner, the relationship between\ndata values and visual encodings through a JSON specification.\n\nThis means that the Vega-Lite figures produced by ``pdvega`` are portable: you can send someone the\nresulting JSON specification and they can choose whether to render it interactively online, convert it to\na PNG or EPS for static publication, or even enhance and extend the figure to learn more about the data.\n\n``pdvega`` is a step in bringing this vision of figure portability and reproducibility to the Python world.\n\n### Relationship to Altair\n\n[Altair](http://altair-viz.github.io) is a project that seeks to design an intuitive declarative API for generating Vega-Lite and Vega visualizations, using Pandas dataframes as data sources.\n\nBy contrast, ``pdvega`` seeks not to design new visualization APIs, but to use the existing ``DataFrame.plot`` [visualization api](https://pandas.pydata.org/pandas-docs/stable/visualization.html) and output visualizations with Vega/Vega-Lite rather than with matplotlib.\n\nIn this respect, ``pdvega`` is quite similar in spirit to the now-defunct [mpld3](http://mpld3.github.io) project, though the scope is smaller and (hopefully) **much** more manageable.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faltair-viz%2Fpdvega","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faltair-viz%2Fpdvega","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faltair-viz%2Fpdvega/lists"}