logoalt Hacker News

jeremyscanvictoday at 2:27 PM3 repliesview on HN

Is ggplot2 considered to be a nice interface to plot things compared to say matplotlib in Python? I'm asking out of curiosity, I haven't touched R much


Replies

stdbrouwtoday at 2:36 PM

Yes, ggplot2 is lovely to work with for complex graphs. Whereas a classic plotting library will have one function to create a bar graph, another to create a line graph, etc., in ggplot instead you can stack layers, each with different properties, variables, shapes, data-dependent colors, scales, whatever you want. It also makes it easy to create grids of similar graphs.

mightyhamtoday at 5:24 PM

I find matplotlib to be clunky and verbose compared to ggplot. When using python, I will often use https://plotnine.org/ because it gives me a nice ggplot like API.

Arodextoday at 4:22 PM

The "grammar of graphics" conceptualized in ggplot is a very cohesive way to make (I think almost) any kind of graph, while remaining a high-level language/DSL.