RPy2 robjects.r.pie gives curious error “'x' values must be positive”
Question
I'm feeling awfully silly, but I can't seem to work this out. I'm trying to make a pie chart, using rpy2 in Python.
from rpy2.robjects import r
import os.path
image = "test.png"
values = [0.5, 0.5]
print "using R"
r.png(image, width=100, height=100)
r.pie(values)
r.dev_off()
Now, to do the same thing directly in R I know I want this:
values <- (0.5, 0.5)
pie(values)
That works fine in the R interpreter. I've tried using tuples instead of lists in Python, but was told ValueError: Nothing can be done for the type <type 'tuple'> at the moment.
What Python type corresponds to the R vector? Do I need to use numpy?
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow