11 ms·
Plotnine: A grammar of graphics for Python
- vignesh_m 9y agoIf this is an implementation of ggplot2, what does it offer over http://ggplot.yhathq.com/ http://ggplot.yhathq.com/? I don't mean to undermine your project, just wanted to know about significant differences.
- ExcaliburZero 9y agoI too am interested in what the differences are. I have used the yhathq ggplot library for a while and it is quite useful but I sometimes find it lacking certain types of plots and documentation. Also the last commit to the yhathq ggplot library was on Nov 20, 2016, so this library looks like it is currently more active in development. Edit: Someone made an article comparing the two here: http://pltn.ca/plotnine-superior-python-ggplot/ http://pltn.ca/plotnine-superior-python-ggplot/
- kaffee 9y ago- yhat's ggplot has 256 commits, 13 contributors, last commit Nov 2016. - plotnine has 1,283 commits, 42 contributors, most recent commit is 3 days ago.
- asdfgadsfgasfdg 9y agoThese comparisons are pointless. Would you like to compare loc as well? How about man hours spent? The only comparison that is important is how well the two projects work. I have no idea how well plotnine works yet (but I intend to find out). I do know that ggplot works OK - and seeing as it leverages matplotlib if there is anything that isn't implemented I can finish the plot off manually. EDIT it seems that plotnine also leverages matplotlib and produces nicer plots for some common cases :).
- cle 9y agoIt's not pointless at all. For long-term maintenance, the community strength and level of active development is just as important (and sometimes more important) than minor feature differences.
- jacobolus 9y agoI would often rather use a decade-old project that was developed solo by a world-class expert dumping code over the wall once every 6 months than a community project being hacked on by 100 amateurs. Without additional context I find recency of last commit and number of committers to be almost impossible to draw useful conclusions from.
- neves 9y agoYou are right, but we don't the proficiency of the developers. The best info we have is the repository update info. That's what you have to quickly compare the projects.
- cle 9y agoOf course you should seek additional context if you need it. Community strength and commit activity are pretty useful to consider though. One useful conclusion: security bugs are likely to be fixed in a timely manner that won't put your users at risk.
- jacobolus 9y ago
- has2k1 9y agoPlotnine is a real grammar of graphics. Checkout http://plotnine.readthedocs.io/en/stable/about-plotnine.html http://plotnine.readthedocs.io/en/stable/about-plotnine.html for a little more information about the two projects.
- closed 9y agoThis library started as a refactor of that project, after it laid broken and unmaintained for a long time. Having followed the yhat ggplot for a long time, I've lost faith that it will be actively maintained.
- coldtea 9y agoThis is nice and all, but the syntax and names are totally unintuitive. If I'm to dig in the manual, I might as well build my plots with the standard syntax of any random plotting library. Is this "grammar of graphics" any good if you invest more time in it?
- alsocasey 9y ago> Is this "grammar of graphics" any good if you invest more time in it? For some, it was probably one of THE things that kept them using R over something else. Yes, definitely worth it.
- npgatech 9y agoI find it the opposite. The syntax is the most intuitive of all plotting applications. Layers are as follows [1] 1. Data 2. Aesthetic mappings 3. Statistical transformation (stat) 4. Geometric object (geom) 5. Position adjustment Once you get a hang of this, it becomes easy to create new plots purely from the understanding of the layers. In matplotlib or even in Seaborn, I find myself constantly Googling for examples. ggplot2 is the most beautiful thing to happen in visualization space! [1] Wickham, Hadley, and Carson Sievert. "4.4.1 Layers." Ggplot2: Elegant Graphics for Data Analysis. Dordrecht: Springer, 2016. N. pag. Print.
- ngould 9y agoYes, it's worth investing the time. Grammar of graphics is life changing if data visualization is part of your day to day.
- has2k1 9y agoThere are a few concepts to learn. With a grammar, you can create plots in 5 minutes that would take an hour to create using "the standard syntax". For many people once they experience it, they do not want to go back. You could be one of them.
- sirrice 9y agoRecreating and keeping up with Hadley's hard work is challenging, particularly because ggplot2's layout and extensions are really nice and continue to evolve. As an alternative that preserves the full power of Wickham's implementation, pygg[1] is a Python wrapper that provides R's ggplot2 syntax in Python and runs everything in R. [1] https://github.com/sirrice/pygg https://github.com/sirrice/pygg
- skierscott 9y agoAnother grammar of graphics: altair[1]. The altair are simpler and easier to read, i.e. Chart(df).mark_point().encode( x='age', y='height', color='sex') Also, see Jake Vaderplas's talk on an overview of Python visualization tools at https://youtube.com/watch?v=FytuB8nFHPQ https://youtube.com/watch?v=FytuB8nFHPQ [1]:https://altair-viz.github.io https://altair-viz.github.io
- peatmoss 9y agoI feel like a lot of attempts to recreate ggplot2 end up being superficial because they don't recognize / duplicate the power of the underlying Grid graphics that ggplot2 uses. I know that web technologies are all the rage these days, but at least for static, publication-ready graphics, Grid is really nice substrate, with well thought out lower-level abstractions. EDIT: I should also add that it's documented within an inch of its life should anyone feel that it's worth recreating: https://stat.ethz.ch/R-manual/R-devel/library/grid/html/grid-package.html https://stat.ethz.ch/R-manual/R-devel/library/grid/html/grid...
- platz 9y agoIn what way does eschewing the underlying Grid graphics make a less desirable experience for a ggplot2 port?
- peatmoss 9y agoThe ports I see feel like a < 100% enumeration of the plots in the mainline ggplot2 package. However, there are heaps of great extensions to ggplot2 that I suspect are in part due to there being a carefully thought out set of abstractions at the low level of Grid that mesh nicely with the high level abstractions of ggplot. ggplot2 being built on top of Grid means that modestly complex stuff is easy (in ggplot2 by itself), but that it's relatively easy to drop down into the lower layer (grid) to do more.
- Waterluvian 9y agoWhat is meant by "a grammar"? Is it the way we concatenate functions to create what's essentially a sentence of what we want the plot to be?
- vignesh_m 9y agoI found http://r-statistics.co/ggplot2-Tutorial-With-R.html http://r-statistics.co/ggplot2-Tutorial-With-R.html helpful to learn about the gglplot "grammar of graphs"
- perturbation 9y agoggplot2 was inspired by: https://www.amazon.com/Grammar-Graphics-Statistics-Computing/dp/0387245448 https://www.amazon.com/Grammar-Graphics-Statistics-Computing... and Hadley Wickham wrote about it in http://vita.had.co.nz/papers/layered-grammar.pdf http://vita.had.co.nz/papers/layered-grammar.pdf. I'm no expert, but I think that one of the main ideas is to separate the elements of making a plot from the way that the data is presented. For example, in ggplot2, you have the data that will go into the graph, the type of plot (or "geometry") that defines how the data are presented (scatterplot, bar plot, etc.), and then various "layers" that can be added that affect style. In order to split a plot into subplots, you simply define how it is to be faceted (what column should be used to define groups). Grammar-of-graphics moves plotting away from the "turtle graphics" model and lets you specify what should be done. Then ggplot figures out how to do it, kind of like SQL vs. writing for loops to retrieve information.
- Waterluvian 9y agoAha! Thank you. So it's kind of like a declarative way of plotting.
- has2k1 9y agoSurprise to see this at the top, I am the creator* of plotnine. The most common question seems to be, what to expect of plotnine? The answer; a high quality implementation of a grammar of graphics with an API that closely matches ggplot2, and more. I also want other packages to be able to build off of plotnine, e.g. a package with the functionality of Seaborn could be built off of plotnine. The only constraint should be whether the backend -- in this case Matplotlib -- does stand in the way. Matplotlib is evolving (though slowly) and has a very receptive community so there is lots of hope. * - Many people contributed to its history.
- m-j-fox 9y agoLooks sweet. May I ask: what did you find wanting in the other attempts (like Seaborne)?
- has2k1 9y agoSeaborn is not lacking in any way, it has a goal and it accomplishes it. However, I think Seaborn would have been easier to create if it had been based on a grammar based package, a few caveats not withstanding.
- closed 9y agoI watched your refactor of yhat's py ggplot branch, and was disappointed when glamp dropped in a totally new implementation out of the blue. Thanks for all your hard work--glad it is it's own package now :).
- has2k1 9y agoWell, I think it was different priorities. My main objective for contributing was to have a full on grammar of graphics package in python. I appreciate those warm feelings from afar.
- lorenzfx 9y agoThis looks interesting, but I find the documentation somewhat lacking. Is the user supposed to know ggplot?
- stared 9y agoI get it is ggplot-based, by as it is Python, why not being more idiomatic and using chaining instead of adding?