Skip to content

Instantly share code, notes, and snippets.

@thistleknot
Created November 21, 2021 19:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thistleknot/65349f605a5debf225008a83da6ec4e1 to your computer and use it in GitHub Desktop.
Save thistleknot/65349f605a5debf225008a83da6ec4e1 to your computer and use it in GitHub Desktop.
rpy2 image example
import rpy2.robjects as ro
from rpy2.robjects.packages import importr
grdevices = importr('grDevices')
grdevices.png(file="Rpy2Curve.png", width=512, height=512)
p = ro.r('curve(sin, -2*pi, 2*pi)')
# plotting code here
grdevices.dev_off()
from IPython.display import display
from PIL import Image
path=r"Rpy2Curve.png"
display(Image.open(path))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment