Groups
Groups
Sign in
Groups
Groups
R軟體使用者論壇
Conversations
About
Send feedback
Help
如何重疊兩張散佈圖
2,731 views
Skip to first unread message
chiajung
unread,
Oct 10, 2015, 11:25:58 PM
10/10/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to R軟體使用者論壇
我想要將兩組資料的散佈圖及他們的迴歸線全部重疊放在一張圖
但是我畫第二筆資料的散佈圖時,r就會自動跑另一張圖
曾試過用 par(new=TRUE)合併
但是座標軸會不一致,導致圖形的重疊不具意義
想請教一下如何將兩張圖重疊,並且座標軸會是一致的?
WEPA ^_^
unread,
Oct 11, 2015, 1:17:03 PM
10/11/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to R軟體使用者論壇
Hi friend,
兩張圖重疊應該指的是1列2行之繪圖, please try :
?par
參考以下設定:
op <- par(mfrow=c(1,2)) # set 1 row, 2 columns
plot() # plot1
abline()
plot() # plot2
abline()
par(op) # reset
# end
chiajung於 2015年10月11日星期日 UTC+8上午11時25分58秒寫道:
chiajung
unread,
Oct 12, 2015, 10:13:29 AM
10/12/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to R軟體使用者論壇
您好,謝謝您的回覆:D
我後來用
> attach(expenditure)
> plot(Weekly.Consumption.Expenditure~Weekly.Income)
> points(exp~inc,col=3)
第二張散布圖我用point的方式,就可以在一張圖上呈現兩張散布圖,如圖有黑點(第一張散布圖Weekly.Consumption.Expenditure~Weekly.Income)及綠點(第二張散布圖exp~inc):
不知道這樣和您說的圖形是否是一樣的呢?
再次謝謝你的回應喔 ^ ^
WEPA ^_^於 2015年10月12日星期一 UTC+8上午1時17分03秒寫道:
WEPA ^_^
unread,
Oct 13, 2015, 5:16:05 AM
10/13/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to R軟體使用者論壇
Hi friend,
您的方法先用 plot 繪出底圖, 再用points 加上點應該是OK, 原說明 mfrow=c(1,2) 只是在一張圖面上繪製左,右上2張圖. 如果有回答完成,請再按 [標示為完成].
chiajung於 2015年10月12日星期一 UTC+8下午10時13分29秒寫道:
Reply all
Reply to author
Forward
0 new messages