
Lets-plot: An interactive Python plotting library using ggplot's API - oroszgy
https://github.com/JetBrains/lets-plot/blob/master/README_PYTHON.md
======
theandycamps
I've been using R professionally for 4 years. I've been a Python programmer
for 6 years. I've shipped large scale applications built on both languages to
production.

Findings:

I honestly don't get the hype around R's plotting capabilities. ggplot2 is
nice, but far too magical to be easily understood by beginners.

Python offers more intuitive memory management than R (which is really more a
statement on how bad R is at memory efficiency).

R blows Python out of the water when it comes to expressing concise and
readable linear algebra/stats computation. Done right, base R looks like
mathematical pseudo-code.

R's non-standard evaluation is an under-appreciated killer feature. I've seen
complex and powerful DSLs implemented implemented in base R. Python has some
support for this kind of thing, but nowhere near the level of R.

I tried the Tidyverse and found it to be too magical and unstable. In general,
the R package ecosystem is weird. Look at Stack Overflow and you'll find
people touting all sorts of different packages to do simple operations.
Needing to download a million random packages from grad students of the
internet is a recipe for disaster.

~~~
throwaway29103
Genuinely curious: what do you mean with respect to "R's non-standard
evaluation" and its relationship to DSLs? Thanks in advance.

~~~
CreRecombinase
R some very lispy meta-programming features. Very briefly, if I'm a function
(go with me here) `foo <\- function(x,y){whatever}`,and someone calls me,
`foo(bar,baz)` I get to know that `baz` is "bound" to `y`. The caller doesn't
even have to have a `baz` in scope; substituting `y` for `baz` is done lazily,
if the function never asks for the actual value of `y`, there's no problem.
You can read more about this here [http://adv-r.had.co.nz/Computing-on-the-
language.html](http://adv-r.had.co.nz/Computing-on-the-language.html)

~~~
throwaway29103
Great

------
neves
I've been a Python lover for decades. I dislike a lot of characteristics of
the R language, but the ggplot2 package is superior to anything in Python
visualization space. It is really excellent.

~~~
crispyambulance
Wickham was really on to something with ggplot and it's graphical grammar
concept for plots. That and Tidyverse in general, I believe, has saved R from
irrelevance.

I wish more projects would use that way of thinking but it seems that in the
jupyter/julia/python world there's too many choices and they all attempt a
"kitchen-sink" approach for visualization.

~~~
disgruntledphd2
Honestly, R will be fine, even apart from tidyverse.

There's a huge shadow universe of scientists running particular R packages for
these analyses, which never gets seen from HN/programmers.

While Python is definitely (sadly, IMO) a better language for building ML
systems (because more people know it, and it's harder to write impenetrable
code), R is definitely a better DSL for statistical analysis, modelling and
graphics.

It's a shame that R takes its lineage from a language developed in the 70's
(S), as that's a cause of many of the inconsistencies in the core language.

~~~
crispyambulance
I agree R would have been "fine" without Tidyverse-- in the sense that it
would keep a persistent survivable niche base.

I suspect, however, that it would not be anywhere near the top 10 of the TIOBE
index like it is now and that it's userbase would consist of mostly of
statistics practitioners rather than huge swathes of people that need to
perform any basic data analysis.

------
sandGorgon
Do try Altair. Here's a post from someone who comes from ggplot2 to Altair -
[http://fernandoi.cl/blog/posts/altair/](http://fernandoi.cl/blog/posts/altair/)

here's the path to Altair scrapping 20k lines of code to make the api simpler
-
[https://twitter.com/jakevdp/status/1006929128119926786](https://twitter.com/jakevdp/status/1006929128119926786)

Altair is really good. Probably as good as ggplot2

~~~
tbenst
I love Altair but the practice of encoding data alongside the plots makes it
unwieldy for sharing jupyter notebooks (by default a 5000 row limit). Github
also fails to preview Altair plots in .ipynb right now

------
iav
How is it different from plotnine?
[https://projectcodeed.blogspot.com/2020/07/ggplot-grammar-
of...](https://projectcodeed.blogspot.com/2020/07/ggplot-grammar-of-graphics-
in-python.html)

~~~
gimboland
From a cursory glance at both projects, it looks like plotnine doesn't do
interactivity, for a start?

~~~
iav
I wonder why they decided to start from scratch in Kotlin rather than just add
the interactivity feature to plotnine. Now we have two competing projects...

~~~
disgruntledphd2
I'm pretty sure that there have been multiple attempts to recreate ggplot in
python.

I can think of 3-4 off the top of my head.

~~~
closed
AFAIK plotnine is the only one with substantial adoption (2.3k stars on
github) and active development for several years.

Would be curious to hear which ones you're thinking of (since I wouldn't be
surprised if the are others, but also am guessing no others hit both points)

~~~
disgruntledphd2
Honestly, I've definitely seen at least 3-4 attempts hit HN over the past nine
years or so.

Plotnine is the only one another human has told me about, though.

------
neves
Is this an official JetBrains project? Will it be supported?

~~~
proverbialbunny
Yes. You can see it in the url: [https://github.com/JetBrains/lets-
plot/](https://github.com/JetBrains/lets-plot/)

~~~
neves
But does it means that it is a corporate project. Something that won't die
when its leader get a better job?

------
befeltingu
Looks interesting but it feels like this space is a bit crowded with all of
the plotting libraries out there for python.

~~~
antipaul
And yet none has filled the “enjoyable to use” space ;)

~~~
befeltingu
Ya true. I usually end up jumping around depending on use case. Matplotlib
,seaborn, plotly to name a few.

------
leemailll
I don’t think ggplot2 has API

~~~
vlovich123
Read beyond the headline.

> The Lets-Plot for Python library includes a native backend and a Python API,
> which was mostly based on the ggplot2 package well-known to data scientists
> who use R.

> R ggplot2 has extensive documentation and a multitude of examples and
> therefore is an excellent resource for those who want to learn the grammar
> of graphics.

> Note that the Python API being very similar yet is different in detail from
> R. Although we have not implemented the entire ggplot2 API in our Python
> package, we have added a few new features to our Python API.

