用户定义的plot()函数中的轴标记

时间:2014-02-11 17:40:26

标签: r

我正在尝试制作一个条形图,其轴在0-25-50-75-100处断开,但我找不到参数来做到这一点。我的语法来自likert package

plot(x, ordered=FALSE, group.order=names(data))

这显示0-50-100的中断。该图必须是龙卷风图,这是Likert包提供的上述功能。查看示例:

enter image description here

在另一个例子中,您可以看到我想要的内容:

enter image description here

1 个答案:

答案 0 :(得分:0)

我没有Likert包。绘图函数似乎是在R的标准plot()函数之上构建的新方法。因此,您应该能够使用R的标准图形参数。关键参数是xaxp=,它允许您指定刻度线在x轴上的位置。以下是使用hist()

的示例
  # this will allow you to run my code & get the same results
set.seed(1)    
  # here I generate some data
x <- runif(100, min=0, max=100)  
  # this makes the histogram, the xaxp argument does what you're after
hist(x, breaks=c(0,25,50,75,100), xaxp=c(0,100,4))  

enter image description here

有关详细信息,请参阅:R, change the spacing of tick marks on the axis of a plot?