Coder Social home page Coder Social logo

gg2v's Introduction

gg2v

A quick and dirty experiment exploring rendering ggplot2 graphics using vega.

This approach uses relatively little existing ggplot2 code, and the semantics may be slightly different. It is likely to converge over time as both vega and gg2v become more mature, but there's no expectation that ggplot2 and gg2v will ever be exactly concordances. It's probably easier to think of gg2v as an alternative specification and rendering of the graphics DSL defined by ggplot2.

Please note that this is an experimental prototype, and is unlikely to be maintained long-term (unless someone else volunteers).

Currently supported

  • scales:
    • x and y position scales (continuous and categorical)
    • colour gradients
    • limited support for categorical colours
  • geoms: point, line, path, area, text
  • stats: none
  • facets: none
  • position adjustments: none

gg2v's People

Contributors

hadley avatar jcheng5 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gg2v's Issues

column name missing in process_stats

Hey Hadley. I'm playing around with gg2v -- cool stuff. Actually planning to do some stuff with Vega in another language for work, but using gg2v to do some quick and dirty proof of concept work. I've found that some simple plots that work fine when rendered via ggplot break in gg2v, seemingly because column names aren't correctly set in aggregation. Here's an example:

> library(plyr)
> library(ggplot2)
> library(gg2v)
> data(baseball)
> p <- ggplot(baseball) + layer(mapping=aes_string(x='lg',y='r'), geom='bar', stat='summary', fun.y='sum')
> p                                 # this works
> gg2v(plot=p)                 # this doesn't
Error in eval(expr, envir, enclos) : object 'y' not found
> options(error=recover)
> gg2v(plot=p)
Error in eval(expr, envir, enclos) : object 'y' not found

Enter a frame number, or 0 to exit   

1: gg2v(plot = p)
2: plot_spec(plot, data_dir = data_dir, ...)
3: plot_data(plot)
4: Map(function(data, aes) render_data(data, aes, env = plot$plot_env), udata,
5: mapply(FUN = f, ..., SIMPLIFY = FALSE)
6: (function (data, aes) 
render_data(data, aes, env = plot$plot_env))(dots[[1]
7: render_data(data, aes, env = plot$plot_env)
8: eval(var, data, env)
9: eval(expr, envir, enclos)

Selection: 3
Called from: eval(var, data, env)
Browse[1]> head(data)
[[1]]
   x group     V1
1        1   2745
2 AA     2   9563
3 AL     3 299992
4 FL     4   1025
5 NL     5 373241
6 PL     6   2739
7 UA     7    300

Browse[1]> head(aes)
$f5f5faf07687c3b68ede8a16ee7e0bce
$f5f5faf07687c3b68ede8a16ee7e0bce$x
x

$f5f5faf07687c3b68ede8a16ee7e0bce$y
y

I'd like to get this fixed for my demos. The issue seems to be in plot-data.R::process_stats, but I'm not exactly sure what needs to be done. Any suggestions? Thanks!

-Harlan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.