आपकी ऑफलाइन सहायता

BACK
49

सी प्रोग्रामिंग

149

पाइथन प्रोग्रामिंग

49

सी प्लस प्लस

99

जावा प्रोग्रामिंग

149

जावास्क्रिप्ट

49

एंगुलर जे.एस.

69

पी.एच.पी.
माय एस.क्यू.एल.

99

एस.क्यू.एल.

Free

एच.टी.एम.एल.

99

सी.एस.एस.

149

आर प्रोग्रामिंग

39

जे.एस.पी.





डाउनलोड पी.डी.एफ. ई-बुक्स
R - R Box and Whisker Plot

R में Box और Whisker Plot ये काफी महत्वपूर्ण हिस्सा है | Box और Whisker plot को R में create करने के लिए boxplot() इस function का इस्तेमाल किया जाता है |

boxplot() के लिए किसी भी positive या negative values के vector का इस्तेमाल किया जाता है | अगर multiple vectors दिए जाते है तो वो multiple boxplots का वर्णन करता है |

boxplot को create करने के लिए simple numeric vector, list या data frame का उपयोग किया जाता है |

Syntax for Boxplot and Whisker Plot in R

boxplot(x, data, main, notch, varwidth, names)

Parameters for Boxplot() Function in R

x : vector. यहाँ पर vector दिया जाता है |

xlab : string. यहाँ पर x-axis के लिए label दिया जाता है |

ylab : string. यहाँ पर y-axis के लिए label दिया जाता है |

data : data frame. यहाँ पर data frame दिया जाता है |

main : string. यहाँ पर plot के title को दिया जाता है |

notch : Logical. अगर TRUE होता है तो notch को draw किया जाता है |

varwidth : Logical. अगर TRUE दिया जाता है तो boxplot की width को chart के अनुसार vertical center पर adjust किया जाता है |

horizontal : Logical. अगर TRUE दिया जाता है तो boxplot को horizontal set किया जाता है |

names : यहाँ पर हर boxplot के लिए नाम दिया जाता है |

How is the structure of a boxplot?

Boxplot का structure काफी साधारण होता है |

निचे दिए हुए संख्याओं की length 11 है मतलब उनकी length odd है |

अगर x ये c(45,12,47,25,86,15,71,74,58,72,58)

सबसे पहले इन numbers को ascending order में लगाया जाता है |

x का ascending Order : 12,15,25,45,47,58,58,71,72,74,86

उसके बाद उस संख्याओं के Lower Extreme, Lower Quartile, Median, Upper Quartile और Upper Extreme को ढूंढे |

अब इन पांच values की मदद से boxplot और Whisker plot को create किया जाएगा |




अगर दी हुई संख्याओं की length even होती है तो,

x = c(12,15,25,35,43,45,47,58,58,71,72,74)


Simple Example for Box and Whisker Plot in R

Example पर simple box और whisker plot को create किया गया है |

Source Code :
vec = c(12,15,25,45,47,58,58,71,72,74,86)
boxplot(vec)



Add Title, x-axis and y-axis labels on Box and Whisker Plot in R

Example पर plot को title दिया गया है |

Source Code :
vec = c(12,15,25,45,47,58,58,71,72,74,86)
boxplot(vec, xlab = 'X-Axis', ylab = 'Y-Axis', 
main = 'My First Box and Whisker Plot in R')



Add color on Box and Whisker Plot in R

Example पर boxplot को 'red' color दिया गया है |

Source Code :
vec = c(12,15,25,45,47,58,58,71,72,74,86)
color = c('red')
boxplot(vec, xlab = 'X-Axis', ylab = 'Y-Axis', 
main = 'My First Box and Whisker Plot in R',
col = color)



Draw Notch on Box and Whisker Plot in R

Example पर notch को draw किया गया है |

Source Code :
vec = c(12,15,25,45,47,58,58,71,72,74,86)
color = c('red')
boxplot(vec, xlab = 'X-Axis', ylab = 'Y-Axis', 
main = 'My First Box and Whisker Plot in R',
col = color, notch = TRUE)



Set Horizontal Box and Whisker Plot in R

Example पर box और whisker plot को horizontally set किया गया है |

Source Code :
vec = c(12,15,25,45,47,58,58,71,72,74,86)
color = c('red')
boxplot(vec, xlab = 'X-Axis', ylab = 'Y-Axis', 
main = 'My First Box and Whisker Plot in R',
col = color, notch = TRUE, horizontal = TRUE)



Add Multiple Box and Whisker Plot in R

Example पर multiple box और whisker plot को add किया गया है |

Source Code :
vec1 = c(15,45,4,8,78,14,25,45,87)
vec2 = c(14,87,2,14,94,1,32,25,69)
color = c('red','blue')
boxplot(vec1, vec2, xlab = 'X-Axis', ylab = 'Y-Axis', 
main = 'My First Box and Whisker Plot in R',
col = color, horizontal = TRUE)



Add Name for each Box and Whisker Plot in R

Example पर हर box और whisker plot के लिए अलग-अलग name दिया गया है |

Source Code :
vec1 = c(15,45,4,8,78,14,25,45,87)
vec2 = c(14,87,2,14,94,1,32,25,69)
color = c('red','blue')
boxnames = c('Box Plot1','Box Plot2')
boxplot(vec1, vec2, xlab = 'X-Axis', ylab = 'Y-Axis', 
main = 'My First Box and Whisker Plot in R',
col = color, horizontal = TRUE, names = boxnames)



Add Box and Whisker Plot using data frame in R

Example पर data frame की मदद से multiple box और whisker plot को set किया गया है |

Source Code :
df = data.frame(box1 = c(15,45,4,8,78,14,25,45,87),
box2 = c(45,24,14,47,54,68,23,12,42),
box3 = c(42,21,35,64,42,14,56,57,42))
color = c('red','blue','green')

boxplot(df,xlab = 'X-Axis', ylab = 'Y-Axis', 
main = 'My First Box and Whisker Plot in R',
col = color, horizontal = TRUE)