问题
I'm running R from Unix and would like to see all output without any pop-ups. So, for example, if in unix I run
R -f test.r
Where test.r is
value = pnorm(rnorm(10000))
hist(value,breaks=10)
I would like the output to include a histogram drawn in the terminal. Is this possible? I'm assuming I need some kind of Unix plotting package.
回答1:
There is txtplot package. Here is an example from the manual on how to output a histogram:
## text based barchart
x <- factor(c("orange", "orange", "red", "green", "green", "red", "yellow", "purple", "purple", orange"))
txtbarchart(x)
If you need more complex plots I would recommend you take a look at gnuplot and Rgnuplot package that allows to call it from R. gnuplot has "dumb" terminal type which outputs ascii graphics.
来源:https://stackoverflow.com/questions/17748656/how-can-i-get-r-to-plot-something-in-unix-terminal