Skip to content

Instantly share code, notes, and snippets.

@ijlyttle
Created Jan 23, 2020
Embed
What would you like to do?
Altair + reticulate + vegawidget
---
title: "Altair-reticulate"
output: html_document
---
```{r load_packages}
library(vegawidget)
library(reticulate)
```
```{python Altair}
import altair as alt
import pandas as pd
source = pd.DataFrame({
'a': ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I'],
'b': [28, 55, 43, 91, 81, 53, 19, 87, 52]
})
chart1 = alt.Chart(source).mark_bar().encode(
x='a',
y='b'
)
vw = chart1.to_json()
```
```{r display}
as_vegaspec(py$vw)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment