Convert R code into Python code using rpy2 With this you can call the function ggplotRegression in your Python code.