How To use GGPlot in Python

conda install rpy2
from rpy2.robjects.packages import importr utils = importr('utils') 
utils.install_packages("ggplot2")
mirror_number=12 #small positive integer <40 preferable utils.chooseCRANmirror(ind=mirror_number)
import rpy2.robjects as robjects robjects.r("library(ggplot2)")
from rpy2.robjects importpandas2ri pandas2ri.activate()
import rpy2.robjects.lib.ggplot2 as ggplot2
pp=ggplot2.ggplot(heart)+ggplot2.geom_point(ggplot2.aes_string(x="age",y="chol"))
from rpy2.ipython.ggplot import image_png 
img=image_png(pp)
img

--

--

--

Computer Engineer,Sociologist, CSE Master Student

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

What kind of developers are these?

Salesforce Expertise: Managed Services (and More!)

I bet my Elixir solution is better than yours in JavaScript

Step By Step Hyperledger Fabric Installation on Windows 10

Obtaining a static IP address in an unmanaged kubernetes

How to heat your home or office space whilst also helping Covid-19 (SARS-Cov2) research.

Simplifying microservice architecture using DAPR service discovery and conventional coding

“Announcement 🔊

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
anıl kaynar

anıl kaynar

Computer Engineer,Sociologist, CSE Master Student

More from Medium

How to do EDA in python

The data munging process in Python: An overview

EV Stock Daily Cumulative Returns using Python Pandas

Python Panda’s Tutorial (part 1)