Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
In continuation to my earlier R to Python tips, in order to deal with bothPython and R simultaneously for client requests; this time with respect to plots where both schools as of now by large distinct in their plotting styles; Plotline a new python package for grammar of graphics will help us with ease for two language enthusiasts.
Plotline which is almost in same style (> 90%) as ggplot2, claims to be an “implementation of a grammar of graphics in Python, it is based on ggplot2 and allows users to compose plots by explicitly mapping data to the visual objects that make up the plot”. Below is a quick example from the new API page:
## InstallationConda – “conda install -c conda-forge plotnine”(or)PIP – “pip install plotnine”
## quick example from API page
fromplotnineimport ggplot, geom_point, aes, stat_smooth, facet_wrap fromplotnine.dataimport mtcars (ggplot(mtcars, aes('wt', 'mpg', color='factor(gear)')) + geom_point() + stat_smooth(method='lm') + facet_wrap('~gear'))
Happy R and Python Programming!
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.