问题
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