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

查看:43
本文介绍了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)

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

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

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


After adding dev.off

I get

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

解决方案

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

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

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

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