small suggestions for the integrated reticulate package in Rstudio 1.2 preview

rstudio

#1
  1. In some cases, I really need to do some modeling in Python, so it's fantastic to see the integrated reticulate package in Rstudio 1.2 . Thanks to the guys in Rstudio.
    But every time I try to run the Python scripts(e.g.: test.py) directly in Rstudio, It automatically point to the python default version 2.7. So I have to run the following R scripts over and over before I started to work with Python:
library(reticulate)
use_python('/Library/Frameworks/Python.framework/Versions/3.7/bin/python3')

So is there other way to setup a default version permanently in Rstudio for python?

  1. Another thing is the python charts in Rstudio. Some times I need to plot scientific charts with Python Matplotlib. But when I try to zoom out these charts in the Plots Pane, they becomes extremely blurry, far worse than the original R ggplot2.

Just small annoying things bothered me sometimes. hah! I hope the final version will be more perfect.


#2

You can do this by setting a RETICULATE_PATH in your .Rprofile. See: the Python Version Configuration vignette in the reticulate docs for more details (basics excerpted here).

By setting the value of the RETICULATE_PYTHON environment variable to a Python binary. Note that if you set this environment variable, then the specified version of Python will always be used (i.e. this is prescriptive rather than advisory). To set the value of RETICULATE_PYTHON , insert Sys.setenv(RETICULATE_PYTHON = PATH) into your project’s .Rprofile, where PATH is your preferred Python binary.


#3

Thanks, mara, that really helps. :grin: