Giter Site home page Giter Site logo

pygg's People

Contributors

psfotis avatar sirrice avatar tyberiusprime 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  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pygg's Issues

Update ggplot functions generator

Maybe the R script can generate a standalone pygg_functions.py file that pygg.py can import *? That way don't need to copy and paste in the future

Pass data objects into ggplot call

Current version of ggplot() takes a variable name as input, by default "data", and relies on ggsave()'s prefix argument to set the data object.

ggplot('data', aes(...)) + ggsave(..., prefix=data_py(dataobject))

Modify ggplot() call to accept a data object as input, and let it configure the prefix under the covers. ggsave's prefix argument option can still be used for full control

Use tempfile to store temporary CSV files

The current code uses a hardcoded tempfile /tmp/_pygg_data.csv, which may cause conflicts between multiple versions of ggpy running on the same machine as well as leaks data onto the filesystem that lives after the lifetime of a program using pygg. Replace with a true temporary file from tempfile.

ggplot with two data

In this R script, there are two data: mean_wt and mtcars. However, current pygg only resolve one data and can not resolve the mean_wt.

mean_wt <- data.frame(cyl = c(4, 6, 8), wt = c(2.28, 3.11, 4.00))
ggplot(mtcars, aes(mpg, wt, colour = wt)) +
  geom_point() +
  geom_hline(aes(yintercept = wt, colour = wt), mean_wt) +
  facet_wrap(~ cyl)

Example source

Remove special code for facet_*

facet_grid and facet_wrap have a special API right now to handle the formulas in R. Update the code so that the interface isn't specialized and you use the functions directly with escaped strings:

Today:

p = p + facet_grid('x', 'y')

Proposed API:

p = p + facet_grid(esc("x ~ y"))

Unit tests are too limited

Current unit tests for pygg are too limited in scope. Many individual functions (e.g., data_py, is_pandas_df, to_r) can be tested quite effectively.

Error with stat='identity' in geom_bar

A minimal example is

import pygg
import pandas as pd

data = pd.DataFrame({'x': range(10), 'y': range(10, 20)})
p = pygg.ggplot(data, pygg.aes(x='x', y='y'))
g = pygg.geom_bar(stat='identity')
pygg.ggsave('file.png', p + g, data=None)

The traceback says

ValueError: ggplot2 bridge failed for program: library(ggplot2)

data = read.csv("/tmp/tmpICcyg2",sep=",")

p = ggplot(data,aes(x=x,y=y)) + geom_bar(stat=identity)
ggsave("file.png",p,height=8,scale=1,width=10). Check for an error

Python 3?

Is there any progress on python 3 compatibility?

Generalize to_r function to convert more python expressions to R

Right now to_r doesn't understand basic python types like lists and dictionaries and it would be more nature to use those data structures when invoking ggplot via pygg in some function calls. to_r should be generalized to recursively convert common python data structures to reasonable R equivalents.

For example, right you can you have to say:

    p += pygg.scale_y_continuous(limits="c(0, 1)")

but it would be more natural to be able to say this as:

    p += pygg.scale_y_continuous(limits=[0, 1])

Support Python 3

I am not familiar with the Python-R bindings, but glancing over pygg's codebase it seems fairly doable.

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.