Created
November 21, 2021 19:22
-
-
Save thistleknot/65349f605a5debf225008a83da6ec4e1 to your computer and use it in GitHub Desktop.
rpy2 image example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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