خرید بک لینک

Vote count: 0

I use function fitdist in package fitdistrplus to get the best distribution fitted to my data and draw the ppcomp figure , I use the example codes of ?fitdistrplus to replace my data and codes.

data(groundbeef)
serving <- groundbeef$serving
fitW <- fitdist(serving, "weibull")
fitg <- fitdist(serving, "gamma")
fitln <- fitdist(serving, "lnorm")
ppcomp(list(fitW, fitg, fitln), legendtext=c("Weibull", "gamma", "lognormal"))

ppcomp

So far so good! But look at the left bottom of the pic, there is some space, or the axes does not start from zero!

So I googled and find two methods: One method in the base plot, xaxs and yaxs are used.

set.seed(1234)
x <- runif(100, min=0, max=100)
y <- runif(100, min=0, max=100)
plot(x,y,xaxs="i",yaxs="i",xlim=c(0,100),ylim=c(0,100))

base plot

Another method in the ggplot2, expand=c(0,0) is used.

df <- data.frame(x=x,y=y)
ggplot(df,aes(x,y)) + geom_point() + scale_x_continuous(expand = c(0,0)) + scale_y_continuous(expand = c(0,0))

expand

So I try to use these two methods to draw the ppcomp figure,

ppcomp(list(fitW, fitg, fitln), legendtext=c("Weibull", "gamma", "lognormal"),xaxs="i",yaxs="i")

but error occurs:

Error in legend(x = xlegend, y = ylegend, bty = "n", legend = legendtext,  : 
  unused arguments (xaxs = "i", yaxs = "i")

So, what should I do to complete the goal without the error, or what is the right codes?

asked 11 secs ago

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 14 تير 1395 ساعت: 12:56

صفحه بندی