मैं ggplots के संयोजन के लिए par() या लेआउट() फ़ंक्शंस का उपयोग करने के बारे में सोच रहा हूं। क्या उन कार्यों का उपयोग करना संभव होगा?par() या लेआउट() फ़ंक्शन का उपयोग करते हुए ggplot2 (एकल प्लॉट में नहीं) की संयुक्त प्लॉट?
कहें कि मैं हिस्टोग्राम के लिए स्कैटरप्लॉट और ggplot के लिए ggplot प्लॉट करना चाहता हूं। और मैं दो भूखंडों को जोड़ना चाहता हूं (एक सिंगल प्लॉट में नहीं)। क्या यह लागू है?
मैंने ggplot फ़ंक्शंस का उपयोग किये बिना आर में सरल साजिश के साथ इसे आजमाया। और यह वास्तव में काम करता है।
इधर, त्वरित-आर से एक नमूना है लिंक: http://www.statmethods.net/advgraphs/layout.html
# 4 figures arranged in 2 rows and 2 columns
attach(mtcars)
par(mfrow=c(2,2))
plot(wt,mpg, main="Scatterplot of wt vs. mpg")
plot(wt,disp, main="Scatterplot of wt vs disp")
hist(wt, main="Histogram of wt")
boxplot(wt, main="Boxplot of wt")
# One figure in row 1 and two figures in row 2
attach(mtcars)
layout(matrix(c(1,1,2,3), 2, 2, byrow = TRUE))
hist(wt)
hist(mpg)
hist(disp)
लेकिन जब मैं ggplot उपयोग करने के लिए, और साजिश गठबंधन की कोशिश, मैं एक उत्पादन नहीं मिलता है।
ggplot2 है आधार ग्राफिक्स नहीं है ताकि आप ggplot2 और लेआउट या par (mfrow) को गठबंधन नहीं कर सकें। आपको gridExtra में प्लॉट.रेंज आदि का उपयोग करने की आवश्यकता है। या, आप ग्रिड सिस्टम में व्यूपोर्ट के साथ खेल सकते हैं। – kohske
चूंकि आपने 'लेआउट()' जैसे कुछ के लिए कहा था, तो शायद आपको 'grid.arrange() '(कोहस्के का उल्लेख किया गया) जैसे कुछ चाहिए। [यह लिंक किया गया पोस्ट] (http://stackoverflow.com/questions/7993722/creating-arbitrary-panes-in-ggplot2/7996205#7996205) (और विशेष रूप से बेन बोल्कर का जवाब) आपको एक अच्छा प्रारंभिक बिंदु देगा। –