שינוי יחידת המרווח על ציר X

14 views
Skip to first unread message

Avshalom Koren

unread,
Nov 22, 2015, 1:36:37 PM11/22/15
to Israel R User Group
שלום לכולם,
כיצד משנים את יחידת המרווח על ציר X ב- R?
הארגומנטים של  xlim הם ערכי המינימום והמקסימום ואני מחפש דרך לקבוע את גודל הקפיצה.
לדוגמה, כתבתי את הקוד הבא ב- R להמחשת מושג התוחלת. במקום קפיצות של 200 על ציר ה- X אני רוצה קפיצות של 100.
אשמח לעזרה.
תודה, אבשלום
n<-c(1:1000)
x = 1:4
p = c(35,15,5,1)/56
expectation=c(0, rep=length(n))
for (i in 1:length(n))
{
  expectation[i]<-mean(sample(x, n[i], prob=p, replace = TRUE ))
}
plot(n, expectation, type = 'l', lwd=1, col=2, pch=16 ,xlim=c(0,1000), ylim=c(1,4), las=1 , ylab="E(X)")
abline(h=1.5, col=4,lty=1)


Rplot.png

Tal Galili

unread,
Nov 22, 2015, 1:52:36 PM11/22/15
to israel-r-...@googlegroups.com
שלום אבשלום, מה שלומך? (אל תענה לי פה, תעבור למייל פרטי :) )

לשאלתך, הפרמטר שאתה מחפש לשנות הוא at.
שים לב שרוחב החלון צריך להיות כזה שיספיק לכל הטקסט (אפשר גם להקטין אותו עם פרמטרים מתאימים)

הנה דוגמא:

n<-c(1:1000)
x = 1:4
p = c(35,15,5,1)/56
expectation=c(0, rep=length(n))
for (i in 1:length(n)) 
{
  expectation[i]<-mean(sample(x, n[i], prob=p, replace = TRUE ))
}
plot(n, expectation, type = 'l', lwd=1, col=2, pch=16 ,xlim=c(0,1000), ylim=c(1,4), las=1 , ylab="E(X)", at = seq(0,1000, 100))
abline(h=1.5, col=4,lty=1)


טל



----------------Contact Details:-------------------------------------------------------
Contact me: Tal.G...@gmail.com
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English)
----------------------------------------------------------------------------------------------


--
You received this message because you are subscribed to the Google Groups "Israel R User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to israel-r-user-g...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Avshalom Koren

unread,
Nov 22, 2015, 2:11:00 PM11/22/15
to Israel R User Group
תודה טל (כתבתי לך גם בפרטי...)!

בתאריך יום ראשון, 22 בנובמבר 2015 בשעה 20:52:36 UTC+2, מאת Tal Galili:
To unsubscribe from this group and stop receiving emails from it, send an email to israel-r-user-group+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages