This repository has been archived by the owner on Feb 9, 2024. It is now read-only.
ggvis 0.2
The main change is that ggvis now uses a functional approach to building plots. Instead of doing:
ggvis(mtcars, props(~wt, ~mpg)) + layer_point()
You now do:
layer_points(ggvis(mtcars, ~wt, ~mpg))
This is a bit clunky, but we streamline it by using the pipe operator (%>%
, from magrittr):
mtcars %>%
ggvis(~wt, ~mpg) %>%
layer_points()
We think that this change will make it a little easier to create plots, and just as importantly, it's made the internals of ggvis much much simpler (so now we actually understand how it works!). As part of these changes:
- We now have a better idea of how layers should work. These are the "magic"
bits of ggvis - they can inspect the current state of the plot, the data and
the visual properties and decide what to do. For an example, take a look at
layer_guess()
which implements the most important parts ofqvis()
,
guessing which type of layer to use to display the data. ggvis()
and all layer functions now take props directly - you no longer
need to useprops()
in everyday work.- You can seamlessly use data transformations from dplyr: that means that
you usegroup_by()
to define grouping in the plot, and you can use
filter()
,summarise()
,mutate()
andarrange()
both inside and
outside of visualisations. Seeggvis?dplyr
for more examples. - Data transformations are now handled by
compute_*()
functions. These
are S3 generics with methods for data frames, grouped data frames and
ggvis objects. This means that any transformation done by ggvis for
a visualisation (e.g. smoothing) can also be done on ordinary datasets so
you can see exactly what variables are being created. - It is possible to extract all the data objects, including those that are
created by a transformation function, with theget_data()
function. This
makes it easier to inspect and understand what's happening to your data. - The
explain()
function shows the structure of the ggvis object in a
somewhat-readable format. - New
handle_click()
,handle_hover()
,handle_resize()
and
handle_brush()
allow you to connect callbacks to important ggvis events.
A fully reactive interface will follow in the future. - The process of embedding ggvis plots in shiny apps has been overhauled and
simplified. See details inggvis?shiny
and sample apples indemos/apps/
. - A new built-in dataset: cocaine, recording cocaine seizures in the US in 2007.
We plan to transition our dummy examples that use mtcars to something
more useful/informative over time.