我怎样才能让 R 在 Unix 终端中绘制一些东西 [英] How can I get R to plot something in Unix terminal

查看:34
本文介绍了我怎样才能让 R 在 Unix 终端中绘制一些东西的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 Unix 上运行 R 并且希望看到所有输出而没有任何弹出窗口.因此,例如,如果在 unix 中我运行

R -f test.r

test.r 在哪里

value = pnorm(rnorm(10000))历史(值,中断= 10)

我希望输出包含在终端中绘制的直方图.这可能吗?我假设我需要某种 Unix 绘图包.

解决方案

txtplot 包.这是手册中有关如何输出直方图的示例:

## 基于文本的条形图x <- factor(c("orange", "orange", "red", "green", "green", "red", "yellow", "purple", "purple", orange"))txt条形图(x)

如果您需要更复杂的图,我建议您查看 gnuplotRgnuplot 允许从 R 调用它的包.gnuplot 具有输出 ascii 图形的哑"终端类型.>

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.

解决方案

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.

这篇关于我怎样才能让 R 在 Unix 终端中绘制一些东西的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆