Science Score: 23.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
2 of 10 committers (20.0%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (19.4%) to scientific vocabulary
Keywords
altair
interactive
r
reticulate
vega-lite
visualization
Keywords from Contributors
visualisation
package-creation
devtools
Last synced: 6 months ago
·
JSON representation
Repository
R interface to 'Altair'
Basic Info
- Host: GitHub
- Owner: vegawidget
- License: other
- Language: R
- Default Branch: main
- Homepage: https://vegawidget.github.io/altair
- Size: 30.2 MB
Statistics
- Stars: 91
- Watchers: 4
- Forks: 10
- Open Issues: 3
- Releases: 6
Topics
altair
interactive
r
reticulate
vega-lite
visualization
Created almost 8 years ago
· Last pushed about 2 years ago
Metadata Files
Readme
Changelog
Contributing
License
Code of conduct
README.Rmd
---
output: github_document
editor_options:
chunk_output_type: console
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
dev = "svg"
)
url_local <- function(x) {
file.path("https://vegawidget.github.io/altair", x)
}
```
[](https://cran.r-project.org/package=altair)
[](https://github.com/vegawidget/altair/actions/workflows/R-CMD-check.yaml)
# altair
The goal of altair is to help you build [**Vega-Lite**](https://vega.github.io/vega-lite/) visualizations.
This package uses [**reticulate**](https://rstudio.github.io/reticulate/) to provide an interface to the [**Altair**](https://altair-viz.github.io) Python package, and the [**vegawidget**](https://vegawidget.github.io/vegawidget/) package to render charts as htmlwidgets.
To avoid confusion, the capitalized word **Altair** shall refer to the Python package; the lower-case word **altair** shall refer to this R package.
This version of the R package supports Python Altair version `r altair::altair_version()$altair`.
## Example
This example is discussed in detail in our [Getting Started article](https://vegawidget.github.io/altair/articles/altair.html):
```{r example}
library("altair")
vega_data <- import_vega_data()
chart <-
alt$Chart(vega_data$cars())$
mark_point()$
encode(
x = "Horsepower:Q",
y = "Miles_per_Gallon:Q",
color = "Origin:N"
)
chart
```
Some things to keep in mind:
- Where you see a `.` in the Python examples, use a `$` instead.
- In your data, columns that contain dots can be wrapped in square brackets in Altair specifications, e.g. `[Sepal.Width]`, to keep Altair from throwing an error.
Alternatively, you can use a double-backslash, e.g. `Sepal\\.Width`.
These and other "gotchas" are compiled along with workarounds in an article: [Field Guide to Python Issues](https://vegawidget.github.io/altair/articles/field-guide-python.html).
## Installation
You can install altair from CRAN with:
```{r cran-installation, eval=FALSE}
install.packages("altair")
```
The development version of is available from [GitHub](https://github.com/vegawidget/altair/):
``` r
# install.packages("devtools")
devtools::install_github("vegawidget/altair")
```
Because of Python, there may be some additional installation steps, described in greater detail in the [Installation article](https://vegawidget.github.io/altair/articles/installation.html).
1. Python must be installed on your system.
We have had success using [Conda](https://conda.io/docs): in particular, [Miniconda](https://conda.io/projects/conda/en/latest/user-guide/install/index.html#anaconda-or-miniconda) works well and installs more-quickly than Anaconda.
If you work in a corporate or institutional environment, you may have to specify the location of your SSL certificate, or deal with a proxy. The installation article has a [section](https://vegawidget.github.io/altair/articles/installation.html#proxies) on this.
1. Create a Conda environment called `"r-reticulate"`.
The reticulate folks [recommend](https://rstudio.github.io/reticulate/articles/python_packages.html) standardizing on a common name for all packages that use reticulate.
For more information, there is a [section](https://vegawidget.github.io/altair/articles/installation.html#python-env) in the installation article.
1. Install Altair into your `"r-reticulate"` environment using `altair::install_altair()`.
1. **Important**: (Python) Altair 4.2.0 does note work with Pandas 2.0; use Pandas 1.5.3 (for example).
This is fixed for (Python) Altair 5, which will be made available in an upcoming release of (R) altair.
You may wish to add a line like this to the `.First()` function in your `.Rprofile`:
```r
reticulate::use_condaenv("r-reticulate")
```
The `use_condaenv()` function is called to provide a [hint to reticulate](https://rstudio.github.io/reticulate/articles/versions.html#order-of-discovery) on which Python environment to use.
### Optional installations
If you have the **[V8](https://CRAN.R-project.org/package=V8)** installed, you can use [vegawidget's image-generating functions](https://vegawidget.github.io/vegawidget/reference/image.html) to convert Altair charts into SVG strings or write SVG files.
With the **[rsvg](https://CRAN.R-project.org/package=rsvg)** and **[png](https://CRAN.R-project.org/package=png)** packages installed, you can get a bitmap array, or write PNG files.
When knitting to a non-HTML format, e.g. `github_document`, this package provides a `knit_print()` function that will intercept the normal renderer, using instead its own renderer, allowing you to specify `"png"` , `"svg"` or `"pdf"`.
Like the image functions, this requires that the V8 package be installed, as well as [rsvg](https://cran.r-project.org/package=rsvg) and [png](https://cran.r-project.org/package=png).
MacOS users will require an X11 system, such as [XQuartz](https://www.xquartz.org), to be installed.
## Articles
The documentation for this package includes some [articles](https://vegawidget.github.io/altair/articles/index.html):
- [Getting Started](https://vegawidget.github.io/altair/articles/altair.html): a walkthrough to get a first chart to work
- [Installation](https://vegawidget.github.io/altair/articles/installation.html): some more-detailed instructions
Gallery:
- An adaptation to R of the [Altair Example Gallery](https://altair-viz.github.io/gallery/), to demonstrate (not least to ourselves) that we are not missing any of the expressiveness of the Python API.
You may be interested in the [Interactive Charts](https://vegawidget.github.io/altair/articles/example-gallery-08-interactive-charts.html) examples.
Examples:
- [Tooltips](https://vegawidget.github.io/altair/articles/tooltips.html): shows how Vega-Lite implements tooltips as an encoding within a chart, with formatting options
- [Vega Datasets](https://vegawidget.github.io/altair/articles/vega-datasets.html): work with [Vega datasets](https://github.com/altair-viz/vega_datasets) using `import_vega_data()`
- [View Composition](https://vegawidget.github.io/altair/articles/view-composition.html): how to facet, add layers to, repeat, and concatenate charts
- [Interactive Examples](https://vegawidget.github.io/altair/articles/interactive.html): a set of examples that work towards linked-brushing of two scatterplots
Field Guides:
- [Field Guide to Python Issues](https://vegawidget.github.io/altair/articles/field-guide-python.html): "gotchas" and their workarounds
- [Field Guide to Rendering Charts](https://vegawidget.github.io/altair/articles/field-guide-rendering.html): specify options to render charts as HTML
## Acknowledgements
This package rests on these foundations:
- [Altair](https://altair-viz.github.io): Python interface to Vega-Lite
- [reticulate](https://rstudio.github.io/reticulate/): R framework to work with Python
- [Vega-Lite](https://vega.github.io/vega-lite/): a grammar of interactive graphics
- [vegawidget](https://vegawidget.github.io/vegawidget/): R package to render Vega(-Lite) visualizations
- [htmlwidgets](https://www.htmlwidgets.org/): R framework to work with JavaScript visualizations
As well, a particular debt is owed to the folks behind the [vegalite](https://github.com/hrbrmstr/vegalite) package, as it provided a lot of the inspiration for these efforts.
This project is a collaborative effort.
In addition to the principal authors:
- [Alicia Schep](https://github.com/AliciaSchep) has contributed the concatenation functions, as well as sorted out many of the Python, JavaScript, and package-API issues.
- [Heike Hofmann](https://github.com/heike) has been an invaluable advisor, providing incisive feedback, and insight into the fundamentals of interactive graphics.
## Contributing
Please note that this project is released with a [Contributor Code of Conduct](`r url_local("CODE_OF_CONDUCT.html")`).
By participating in this project you agree to abide by its terms.
This project also has a [Contributing Guide](`r url_local("CONTRIBUTING.html")`).
Owner
- Name: vegawidget
- Login: vegawidget
- Kind: organization
- Website: https://vegawidget.rbind.io
- Repositories: 7
- Profile: https://github.com/vegawidget
GitHub Events
Total
- Fork event: 1
Last Year
- Fork event: 1
Committers
Last synced: over 2 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| Ian Lyttle | i****e@s****m | 411 |
| Ian Lyttle | i****e | 40 |
| AliciaSchep | a****p@g****m | 22 |
| Ian Lyttle | i****e@m****m | 8 |
| Haley Jeppson | h****n@i****u | 2 |
| Heike Hofmann | h****n@i****u | 1 |
| Andy Reagan | g****b@a****m | 1 |
| Eduardo Ibanez | e****z@g****m | 1 |
| Philipp A | f****p@w****e | 1 |
| Ian Lyttle | i****e@s****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 59
- Total pull requests: 54
- Average time to close issues: 4 months
- Average time to close pull requests: 10 days
- Total issue authors: 13
- Total pull request authors: 6
- Average comments per issue: 1.98
- Average comments per pull request: 0.41
- Merged pull requests: 52
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- ijlyttle (41)
- kphareesh1994 (4)
- AliciaSchep (2)
- haleyjeppson (1)
- eibanez (1)
- pmetzner (1)
- mattijn (1)
- danhamill (1)
- combiz (1)
- rikardn (1)
- flying-sheep (1)
- andyreagan (1)
- jilldaly (1)
Pull Request Authors
- ijlyttle (47)
- olivroy (2)
- flying-sheep (1)
- eibanez (1)
- haleyjeppson (1)
- andyreagan (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- cran 397 last-month
- Total docker downloads: 4,046
- Total dependent packages: 1
- Total dependent repositories: 1
- Total versions: 6
- Total maintainers: 1
cran.r-project.org: altair
Interface to 'Altair'
- Homepage: https://github.com/vegawidget/altair
- Documentation: http://cran.r-project.org/web/packages/altair/altair.pdf
- License: MIT + file LICENSE
-
Latest release: 4.2.3
published over 2 years ago
Rankings
Stargazers count: 4.3%
Forks count: 7.3%
Average: 17.9%
Dependent packages count: 18.1%
Dependent repos count: 24.0%
Downloads: 25.1%
Docker downloads count: 28.3%
Maintainers (1)
Last synced:
6 months ago
Dependencies
DESCRIPTION
cran
- assertthat * imports
- htmlwidgets * imports
- magrittr * imports
- repr * imports
- reticulate >= 1.23 imports
- utils * imports
- vegawidget >= 0.4.1 imports
- V8 * suggests
- dplyr * suggests
- fs * suggests
- httr * suggests
- knitr * suggests
- listviewer >= 2.0.0 suggests
- pkgdown * suggests
- png * suggests
- pryr * suggests
- purrr * suggests
- readr * suggests
- rmarkdown * suggests
- rprojroot * suggests
- rsvg * suggests
- stringr * suggests
- testthat * suggests
- tibble * suggests
- tidyr * suggests
.github/workflows/R-CMD-check.yaml
actions
- actions/checkout v3 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml
actions
- JamesIves/github-pages-deploy-action v4.4.1 composite
- actions/checkout v3 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite