R:坐标轴上没有数字 [英] R: plot has no numbers on axis

查看:566
本文介绍了R:坐标轴上没有数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

极端基本问题,给出代码:

Extremely basic question, given the code:

f_chi_squared <- function(x, r) {
  return ( (x^(r/2 - 1) * exp(1)^(-x/2)) / ( gamma(0.5*r) * 2^(r/2) ) )
}

this_chi_squared <- function(x) {
  return (f_chi_squared(x, 2))
}


plot(this_chi_squared)

我在X和Y轴上没有任何数字.

I do not get any numbers on the X and Y axis.

我想在x和y轴上有数字,而不是像这样空白.

I would like to have numbers on the x and y axis, and not have them blank like this.

我正在使用Rstudio.当我也绘制离散点时,就会出现问题.

I am using Rstudio. The problem appears when I plot discrete points too.

添加dev.off

我知道

Error in readChar(con, 5L, useBytes = TRUE) : cannot open the connection
In addition: Warning message:
In readChar(con, 5L, useBytes = TRUE) :
  cannot open compressed file '/tmp/RtmpQFaYTk/rs-graphics-32344720-c968-4c9e-b94a-0b9de3edf7db/.snapshot', probable reason 'No such file or directory'
Graphics error: Plot rendering error

推荐答案

看来您的保证金太小了.在plot之前使用以下代码:

It seems your margin is too small. use following code before of plot :

par(mar = c(5,5,3,1))

这篇关于R:坐标轴上没有数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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