Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
R
 
 
man
 
 
 
 
 
 
 
 
 
 
 
 

README.md

lifecycle

altqplot

This package is at the moment just a placeholder for one function, alt_qplot. Perhaps more functionality will get added, or this function will move elsewhere, or this package will continue as is…

The goal of alt_qplot is to provide qplot like functionality for the altair R package (which is a port of the Altair python package). Although altair (like ggplot) is very powerful thanks to the grammar of graphics framework, sometimes you want to very quickly make a plot and it is handy to be able to call one simple function. The purpose of the alt_qplot function in this package is to provide a convenient wrapper for quickly making a plot using altair. That plot can further be modified using altair methods, although when making anything beyond very simple plots, using altair directly should be preferred…

Examples

library(altqplot)
#> Loading required package: altair
alt_qplot(x = mtcars$mpg)
#> The installed version of reticulate is 1.7
#> Using this version of reticulate, you will have a problem to access the vega dataset "gapminder".
#> To fix the problem, you can install the dev version of reticulate using: devtools::install_github("rstudio/reticulate")

alt_qplot(x = wt, y = mpg, data = mtcars)

You can also pass the encoding as strings. When doing so, you can specify the type (rather than altair picking its default):

alt_qplot(x = "wt", y = "mpg", color = "gear:N", data = mtcars)

You can also pass along altair’s long form encoding:

alt_qplot(x = alt$X("wt:Q", bin = TRUE), 
          y = alt$X("mpg:Q", bin = TRUE), 
          size = "count()", 
          data = mtcars)

Future work

It might be useful to add a few more options to the alt_qplot function, such as facetting, although the goal is for this function to be pretty limited (b/c if you want something more complex you should use altair itself).

Maybe a Python version of this function/package? (although in python a simpler interface to vegalite already exists through pdvega, and all the nse nonsense in this function doesn’t really have python equivalents afaik)

About

Helper function for altair

Resources

Releases

No releases published

Packages

No packages published

Languages

You can’t perform that action at this time.