# Altair
[![build status](http://img.shields.io/travis/ellisonbg/altair/master.svg?style=flat)](https://travis-ci.org/ellisonbg/altair)
Altair is a declarative statistical visualization library for Python. [Altair
Documentation](altair/notebooks/01-Index.ipynb)
*Altair is developed by [Brian Granger](https://github.com/ellisonbg) and [Jake Vanderplas](https://github.com/jakevdp) in close collaboration with the [UW Interactive Data Lab](http://idl.cs.washington.edu/).*
With Altair, you can spend more time understanding your data and its meaning. Altair's
API is simple, friendly and consistent and built on top of the powerful
[Vega-Lite](https://github.com/vega/vega-lite) JSON specification. This elegant
simplicity produces beautiful and effective visualizations with a minimal amount of code.
Here is an example using Altair to quickly visualize and display a dataset with the native Vega-Lite renderer in the Jupyter Notebook:
```python
from altair import Chart, load_dataset
# load data as a pandas DataFrame
cars = load_dataset('cars')
Chart(cars).mark_point().encode(
x='Horsepower',
y='Miles_per_Gallon',
color='Origin',
)
```
![Altair Visualization](images/cars.png?raw=true)
## A Python API for statistical visualizations
Altair provides a Python API for building statistical visualizations in a declarative
manner. By statistical visualization we mean:
* The **data source** is a `DataFrame` that consists of columns of different data types (quantitative, ordinal, nominal and date/time).
* The `DataFrame` is in a [tidy format](http://vita.had.co.nz/papers/tidy-data.pdf)
where the rows correspond to samples and the columns correspond the observed variables.
* The data is mapped to the **visual properties** (position, color, size, shape,
faceting, etc.) using the group-by operation of Pandas and SQL.
The Altair API contains no actual visualization rendering code but instead
emits JSON data structures following the
[Vega-Lite](https://github.com/vega/vega-lite) specification. For convenience,
Altair can optionally use [ipyvega](https://github.com/vega/ipyvega) to
display client-side renderings seamlessly in the Jupyter notebook.
## Features
* Carefully-designed, declarative Python API based on
[traitlets](https://github.com/ipython/traitlets).
* Auto-generated internal Python API that guarantees visualizations are type-checked and
in full conformance with the [Vega-Lite](https://github.com/vega/vega-lite)
specification.
* Auto-generate Altair Python code from a Vega-Lite JSON spec.
* Display visualizations in the live Jupyter Notebook, on GitHub and
[nbviewer](http://nbviewer.jupyter.org/).
* Export visualizations to PNG images, stand-alone HTML pages and the [Online Vega-Lite
Editor](https://vega.github.io/vega-editor/?mode=vega-lite).
* Serialize visualizations as JSON files.
* Explore Altair with 40 example datasets and over 70 examples.
## Installation
Altair can be installed with the following commands:
```
pip install altair
jupyter nbextension install --sys-prefix --py vega
```
Or using conda:
```
conda install altair
```
## Examples and tutorial
For more information and examples of Altair's API, see the [Altair
Documentation](altair/notebooks/01-Index.ipynb).
To immediately download the Altair Documentation as runnable Jupyter
notebooks, run the following code from a Jupyter Notebook:
```python
from altair import tutorial
tutorial()
```
## Project philosophy
Many excellent plotting libraries exist in Python, including the main ones:
* [Matplotlib](http://matplotlib.org/)
* [Bokeh](http://bokeh.pydata.org/en/latest/)
* [Seaborn](http://stanford.edu/~mwaskom/software/seaborn/#)
* [Lightning](http://lightning-viz.org/)
* [Plotly](https://plot.ly/)
* [Pandas built-in plotting](http://pandas.pydata.org/pandas-docs/stable/visualization.html)
* [HoloViews](http://ioam.github.io/holoviews/)
* [VisPy](http://vispy.org/)
Each library does a particular set of things well.
### User challenges
However, such a proliferation of options creates great difficulty for users
as they have to wade through all of these APIs to find which of them is the
best for the task at hand. None of these libraries are optimized for
high-level statistical visualization, so users have to assemble their own
using a mishmash of APIs. For individuals just learning data science, this
forces them to focus on learning APIs rather than exploring their data.
Another challenge is current plotting APIs require the user to write code,
even for incidental details of a visualization. This results in unfortunate
and unnecessary cognitive burden as the visualization type (histogram,
scatterplot, etc.) can often be inferred using basic information such as the
columns of interest and the data types of those columns.
For example, if you are interested in a visualization of two numerical
columns, a scatterplot is almost certainly a good starting point. If you add
a categorical column to that, you probably want to encode that column using
colors or facets. If inferring the visualization proves difficult at times, a
simple user interface can construct a visualization without any coding.
[Tableau](http://www.tableau.com/) and the [Interactive Data
Lab's](http://idl.cs.washington.edu/)
[Polestar](https://github.com/vega/polestar) and
[Voyager](https://github.com/vega/voyager) are excellent examples of such UIs.
### Design approach and solution
We believe that these challenges can be addressed without the creation of yet
another visualization library that has a programmatic API and built-in
rendering. Altair's approach to building visualizations uses a layered design
that leverages the full capabilities of existing visualization libraries:
1. Create a constrained, simple Python API (Altair) that is purely declarative
2. Use the API (Altair) to emit JSON output that follows the Vega-Lite spec
3. Render that spec using existing visualization libraries
This approach enables users to perform exploratory visualizations with a much
simpler API initially, pick an appropriate renderer for their usage case, and
then leverage the full capabilities of that renderer for more advanced plot
customization.
We realize that a declarative API will necessarily be limited compared to the
full programmatic APIs of Matplotlib, Bokeh, etc. That is a deliberate design
choice we feel is needed to simplify the user experience of exploratory
visualization.
## Development install
Altair requires the following dependencies:
* [pandas](http://pandas.pydata.org/)
* [traitlets](https://github.com/ipython/traitlets)
* [IPython](https://github.com/ipython/ipython)
For visualization in the IPython/Jupyter notebook using the Vega-Lite renderer, Altair additionally requires
* [Jupyter Notebook](https://jupyter.readthedocs.io/en/latest/install.html)
* [ipyvega](https://github.com/vega/ipyvega)
If you have cloned the repository, run the following command from the root of the repository:
```
pip install -e .
```
If you do not wish to clone the repository, you can install using:
```
pip install git+https://github.com/ellisonbg/altair
```
## Testing
To run the test suite you must have [py.test](http://pytest.org/latest/) installed.
To run the tests, use
```
py.test --pyargs altair
```
(you can omit the `--pyargs` flag if you are running the tests from a source checkout).
## Feedback and Contribution
We welcome any input, feedback, bug reports, and contributions via [Altair's
GitHub Repository](http://github.com/ellisonbg/altair/). In particular, we
welcome companion efforts from other visualization libraries to render the
Vega-Lite specifications output by Altair. We see this portion of the effort
as much bigger than Altair itself: the Vega and Vega-Lite specifications are
perhaps the best existing candidates for a principled *lingua franca* of data
visualization.
## Whence Altair?
Altair is the [brightest star](https://en.wikipedia.org/wiki/Altair) in the constellation Aquil
没有合适的资源?快使用搜索试试~ 我知道了~
PyPI 官网下载 | altair-1.0.0rc4.zip
共240个文件
ipynb:81个
py:76个
json:71个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 17 浏览量
2022-02-12
19:10:00
上传
评论
收藏 2.04MB ZIP 举报
温馨提示
资源来自pypi官网。 资源全名:altair-1.0.0rc4.zip
资源推荐
资源详情
资源评论
收起资源包目录
PyPI 官网下载 | altair-1.0.0rc4.zip (240个子文件)
setup.cfg 59B
example.html 2KB
MANIFEST.in 81B
04-BarCharts.ipynb 1.86MB
06-AreaCharts.ipynb 1.16MB
03-ScatterCharts.ipynb 1.12MB
09-CarsDataset.ipynb 889KB
10-IrisPairgrid.ipynb 607KB
05-LineCharts.ipynb 255KB
08-GroupedRegressionCharts.ipynb 199KB
01-Index.ipynb 176KB
01-Index-checkpoint.ipynb 176KB
02-Introduction.ipynb 97KB
07-LayeredCharts.ipynb 78KB
Index.ipynb 7KB
bar_grouped_horizontal.ipynb 3KB
bar_grouped.ipynb 3KB
bar_layered_transparent.ipynb 3KB
trellis_bar.ipynb 3KB
stacked_bar_population.ipynb 3KB
stacked_area_stream.ipynb 3KB
bubble_health_income.ipynb 3KB
stacked_area_normalize.ipynb 3KB
stacked_bar_normalize.ipynb 3KB
trellis_barley.ipynb 2KB
stacked_bar_sum_opacity.ipynb 2KB
stacked_area.ipynb 2KB
stacked_bar_weather.ipynb 2KB
layer_histogram.ipynb 2KB
bar_aggregate_size.ipynb 2KB
layer_line_color_rule.ipynb 2KB
area.ipynb 2KB
bar_aggregate.ipynb 2KB
bar_yearmonth.ipynb 2KB
trellis_anscombe.ipynb 2KB
line_slope.ipynb 2KB
text_scatter_colored.ipynb 2KB
scatter_binned_color.ipynb 2KB
scatter_binned.ipynb 2KB
scatter_connected.ipynb 2KB
trellis_scatter_binned_row.ipynb 2KB
scatter_color_shape_constant.ipynb 2KB
scatter_color_ordinal_custom.ipynb 2KB
scatter_binned_size.ipynb 2KB
scatter_color_custom.ipynb 2KB
line_month.ipynb 2KB
scatter_aggregate_detail.ipynb 2KB
scatter_colored_with_shape.ipynb 2KB
stacked_area_ordinal.ipynb 2KB
area_vertical.ipynb 2KB
trellis_bar_histogram.ipynb 2KB
scatter_color_order.ipynb 2KB
text_table_heatmap.ipynb 2KB
github_punchcard.ipynb 2KB
scatter_bubble.ipynb 2KB
stacked_bar_size.ipynb 2KB
line_step.ipynb 2KB
bar_1d.ipynb 2KB
line_monotone.ipynb 2KB
point_dot_timeunit_color.ipynb 2KB
histogram.ipynb 2KB
trellis_row_column.ipynb 2KB
scatter_color_quantitative.ipynb 2KB
stacked_bar_h_order.ipynb 2KB
tick_strip.ipynb 2KB
trellis_stacked_bar.ipynb 2KB
line.ipynb 2KB
scatter_color_ordinal.ipynb 2KB
scatter.ipynb 2KB
line_detail.ipynb 2KB
scatter_opacity.ipynb 2KB
tick_dot_thickness.ipynb 2KB
line_color.ipynb 2KB
trellis_scatter.ipynb 2KB
point_filled.ipynb 2KB
scatter_color.ipynb 2KB
bar_aggregate_vertical.ipynb 2KB
stacked_bar_v.ipynb 2KB
stacked_bar_h.ipynb 2KB
stacked_bar_1d.ipynb 2KB
circle.ipynb 2KB
square.ipynb 2KB
point_1d.ipynb 2KB
tick_dot.ipynb 2KB
vega-lite-schema.json 82KB
datasets.json 3KB
bar_grouped.json 1KB
bar_grouped_horizontal.json 1KB
bar_layered_transparent.json 1KB
layer_line_color_rule.json 1KB
trellis_bar.json 1KB
layer_histogram.json 1KB
stacked_bar_weather.json 1KB
stacked_bar_population.json 1KB
bubble_health_income.json 1KB
stacked_bar_normalize.json 1KB
trellis_barley.json 1KB
stacked_area_stream.json 996B
stacked_area_normalize.json 968B
stacked_area.json 944B
共 240 条
- 1
- 2
- 3
资源评论
挣扎的蓝藻
- 粉丝: 13w+
- 资源: 15万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于KNN+SVM+CNN+LSTM四种方法实现遥感图像识别python源码.zip
- 基于知识图谱和推荐系统的药物靶标相互作用预测python源码+运行说明.zip
- C#远程桌面实时监控(服务端+客户端)源码.zip
- 基于vgg网络和Resnet的白盒攻击pytorch实现项目源码.zip
- python实现基于迁移学习ResNet网络的食物图像分类项目源码+文档说明(高分项目).zip
- 最全的HFSS 电磁仿真HFSS 仿真2.4G微带天线阵列模型 天线仿真实例模型库60个合集.zip
- Python实现基于PyTorch+Resnet构建花朵图像分类模型项目源码(高分项目).zip
- 基于神经网络CNN&ResNET的图像分类python源码(高分项目).zip
- 神经网络大作业基于两种模型CNN+RNN ResNet+Transformer公式识别项目源码+答辩PPT.zip
- Python实现基于卷积神经网络ResNet的图像分类源码+GUI界面.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功