R: plot has no numbers on axis

自古美人都是妖i 提交于 2019-12-11 17:52:36

问题


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

回答1:


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

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


来源:https://stackoverflow.com/questions/52918211/r-plot-has-no-numbers-on-axis

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!