【问题标题】:R: plot has no numbers on axisR:绘图轴上没有数字
【发布时间】:2019-03-25 20:54:44
【问题描述】:

非常基本的问题,给出代码:

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 轴上没有得到任何数字。

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

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


添加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

【问题讨论】:

  • 可能您无意中运行了一些覆盖默认设备选项的代码。尝试运行dev.off() 来重置设备。如果这不起作用,请重新启动 R
  • 另外xlabylab 不显示
  • @Gregor 谢谢,但我收到了这个新错误(添加到问题中)
  • 你在重启 R 时遇到了这个错误??
  • @Gregor 我使代码更具重现性,当我运行添加了dev.off() 的代码时出现错误

标签: r plot graph label


【解决方案1】:

您的保证金似乎太小了。在plot 之前使用以下代码:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-07-22
    • 2019-02-19
    • 2013-12-29
    • 2018-10-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-08
    相关资源
    最近更新 更多