{"id":461,"date":"2023-07-29T20:16:14","date_gmt":"2023-07-29T20:16:14","guid":{"rendered":"https:\/\/statorials.org\/it\/boxplot-multipli-r\/"},"modified":"2023-07-29T20:16:14","modified_gmt":"2023-07-29T20:16:14","slug":"boxplot-multipli-r","status":"publish","type":"post","link":"https:\/\/statorials.org\/it\/boxplot-multipli-r\/","title":{"rendered":"Come tracciare pi\u00f9 boxplot in un singolo grafico in r"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">Un <a href=\"https:\/\/statorials.org\/it\/baffi-di-scatola\/\" target=\"_blank\" rel=\"noopener\">boxplot<\/a> (a volte chiamato box and whisker plot) \u00e8 un grafico che mostra il riepilogo di cinque numeri di un insieme di dati.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Il riepilogo in cinque numeri include:<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\">Il valore minimo<\/span><\/li>\n<li> <span style=\"color: #000000;\">Il primo quartile<\/span><\/li>\n<li> <span style=\"color: #000000;\">Il valore mediano<\/span><\/li>\n<li> <span style=\"color: #000000;\">Il terzo quartile<\/span><\/li>\n<li> <span style=\"color: #000000;\">Il valore massimo<\/span><\/li>\n<\/ul>\n<p> <span style=\"color: #000000;\">Questo tutorial spiega come tracciare pi\u00f9 boxplot in un unico grafico in R, utilizzando Base R e ggplot2.<\/span><\/p>\n<h3> <strong><span style=\"color: #000000;\">Boxplot basati su R<\/span><\/strong><\/h3>\n<p> <span style=\"color: #000000;\">Per illustrare come creare boxplot in R, lavoreremo con <strong>il set di dati sulla qualit\u00e0 dell&#8217;aria integrato<\/strong> in R:<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#view first 6 rows of \"air quality\" dataset<\/span>\nhead(airquality)\n\n#Ozone Solar.R Wind Temp Month Day\n#1 41 190 7.4 67 5 1\n#2 36 118 8.0 72 5 2\n#3 12 149 12.6 74 5 3\n#4 18 313 11.5 62 5 4\n#5 NA NA 14.3 56 5 5\n#6 28 NA 14.9 66 5 6\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Per creare un unico boxplot per la variabile \u201cOzono\u201d, possiamo utilizzare la seguente sintassi:<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#create boxplot for the variable \u201cOzone\u201d<\/span>\nboxplot(airquality$Ozone)\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Questo genera il seguente boxplot:<\/span><\/p>\n<p> <span style=\"color: #000000;\">Supponiamo invece di voler generare un boxplot per ogni mese nel set di dati. La seguente sintassi mostra come eseguire questa operazione:<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#create boxplot that displays temperature distribution for each month in the dataset<\/span>\nboxplot(Temp~Month,\ndata=airquality,\nmain=\"Temperature Distribution by Month\",\nxlab=\"Month\",\nylab=\"Degrees (F)\",\ncol=\"steelblue\",\nborder=\"black\"\n)\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Ci\u00f2 genera il seguente grafico che mostra un boxplot per ogni mese:<\/span><\/p>\n<h3> <strong><span style=\"color: #000000;\">Diagrammi a scatola in ggplot2<\/span><\/strong><\/h3>\n<p> <span style=\"color: #000000;\">Un altro modo per creare boxplot in R \u00e8 utilizzare il pacchetto <em>ggplot2<\/em> . Utilizzeremo nuovamente il set di dati integrato <strong>sulla qualit\u00e0 dell&#8217;aria<\/strong> per i seguenti esempi.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Per creare un singolo boxplot per la variabile &#8220;Ozono&#8221; nel set di dati sulla qualit\u00e0 dell&#8217;aria, possiamo utilizzare la seguente sintassi:<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#create boxplot for the variable \u201cOzone\u201d<\/span>\nlibrary(ggplot2)\n\nggplot(data = airquality, aes(y=Ozone)) + geom_boxplot()\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Questo genera il seguente boxplot:<\/span><\/p>\n<p> <span style=\"color: #000000;\">Se invece vogliamo generare un boxplot per ogni mese presente nel dataset, possiamo utilizzare la seguente sintassi per farlo:<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#create boxplot that displays temperature distribution for each month in the dataset<\/span>\nlibrary(ggplot2)\n\nggplot(data = airquality, aes(x=as.character(Month), y=Temp)) +\n    geom_boxplot(fill=\"steelblue\") +\n    labs(title=\"Temperature Distribution by Month\", x=\"Month\", y=\"Degrees (F)\")\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Ci\u00f2 genera il seguente grafico che mostra un boxplot per ogni mese:<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Risorse addizionali<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Le seguenti esercitazioni offrono informazioni aggiuntive sui boxplot:<\/span><\/p>\n<p> <a href=\"https:\/\/statorials.org\/it\/quando-utilizzare-il-boxplot\/\" target=\"_blank\" rel=\"noopener\">Quando dovresti utilizzare un box plot? (3 scenari)<\/a><br \/> <a href=\"https:\/\/statorials.org\/it\/simmetria-del-boxplot\/\" target=\"_blank\" rel=\"noopener\">Come identificare l&#8217;asimmetria nei box plot<\/a><br \/> <a href=\"https:\/\/statorials.org\/it\/confrontare-boxplot\/\" target=\"_blank\" rel=\"noopener\">Come confrontare i box plot<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Un boxplot (a volte chiamato box and whisker plot) \u00e8 un grafico che mostra il riepilogo di cinque numeri di un insieme di dati. Il riepilogo in cinque numeri include: Il valore minimo Il primo quartile Il valore mediano Il terzo quartile Il valore massimo Questo tutorial spiega come tracciare pi\u00f9 boxplot in un unico [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Come tracciare pi\u00f9 boxplot in un unico grafico in R - Statorials<\/title>\n<meta name=\"description\" content=\"Un semplice tutorial che mostra come tracciare pi\u00f9 boxplot in un singolo grafico in R.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/statorials.org\/it\/boxplot-multipli-r\/\" \/>\n<meta property=\"og:locale\" content=\"it_IT\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Come tracciare pi\u00f9 boxplot in un unico grafico in R - Statorials\" \/>\n<meta property=\"og:description\" content=\"Un semplice tutorial che mostra come tracciare pi\u00f9 boxplot in un singolo grafico in R.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/it\/boxplot-multipli-r\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-29T20:16:14+00:00\" \/>\n<meta name=\"author\" content=\"Benjamin anderson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Benjamin anderson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minuti\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/it\/boxplot-multipli-r\/\",\"url\":\"https:\/\/statorials.org\/it\/boxplot-multipli-r\/\",\"name\":\"Come tracciare pi\u00f9 boxplot in un unico grafico in R - Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/it\/#website\"},\"datePublished\":\"2023-07-29T20:16:14+00:00\",\"dateModified\":\"2023-07-29T20:16:14+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae\"},\"description\":\"Un semplice tutorial che mostra come tracciare pi\u00f9 boxplot in un singolo grafico in R.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/it\/boxplot-multipli-r\/#breadcrumb\"},\"inLanguage\":\"it-IT\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/it\/boxplot-multipli-r\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/it\/boxplot-multipli-r\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Casa\",\"item\":\"https:\/\/statorials.org\/it\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Come tracciare pi\u00f9 boxplot in un singolo grafico in r\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statorials.org\/it\/#website\",\"url\":\"https:\/\/statorials.org\/it\/\",\"name\":\"Statorials\",\"description\":\"La tua guida all&#039;alfabetizzazione statistica!\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statorials.org\/it\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"it-IT\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae\",\"name\":\"Benjamin anderson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"it-IT\",\"@id\":\"https:\/\/statorials.org\/it\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/statorials.org\/it\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"contentUrl\":\"https:\/\/statorials.org\/it\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"caption\":\"Benjamin anderson\"},\"description\":\"Ciao, sono Benjamin, un professore di statistica in pensione diventato insegnante dedicato di Statorials. Con una vasta esperienza e competenza nel campo della statistica, sono ansioso di condividere le mie conoscenze per potenziare gli studenti attraverso Statorials. Scopri di pi\u00f9\",\"sameAs\":[\"https:\/\/statorials.org\/it\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Come tracciare pi\u00f9 boxplot in un unico grafico in R - Statorials","description":"Un semplice tutorial che mostra come tracciare pi\u00f9 boxplot in un singolo grafico in R.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/statorials.org\/it\/boxplot-multipli-r\/","og_locale":"it_IT","og_type":"article","og_title":"Come tracciare pi\u00f9 boxplot in un unico grafico in R - Statorials","og_description":"Un semplice tutorial che mostra come tracciare pi\u00f9 boxplot in un singolo grafico in R.","og_url":"https:\/\/statorials.org\/it\/boxplot-multipli-r\/","og_site_name":"Statorials","article_published_time":"2023-07-29T20:16:14+00:00","author":"Benjamin anderson","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Benjamin anderson","Est. reading time":"2 minuti"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/it\/boxplot-multipli-r\/","url":"https:\/\/statorials.org\/it\/boxplot-multipli-r\/","name":"Come tracciare pi\u00f9 boxplot in un unico grafico in R - Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/it\/#website"},"datePublished":"2023-07-29T20:16:14+00:00","dateModified":"2023-07-29T20:16:14+00:00","author":{"@id":"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae"},"description":"Un semplice tutorial che mostra come tracciare pi\u00f9 boxplot in un singolo grafico in R.","breadcrumb":{"@id":"https:\/\/statorials.org\/it\/boxplot-multipli-r\/#breadcrumb"},"inLanguage":"it-IT","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/it\/boxplot-multipli-r\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/it\/boxplot-multipli-r\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Casa","item":"https:\/\/statorials.org\/it\/"},{"@type":"ListItem","position":2,"name":"Come tracciare pi\u00f9 boxplot in un singolo grafico in r"}]},{"@type":"WebSite","@id":"https:\/\/statorials.org\/it\/#website","url":"https:\/\/statorials.org\/it\/","name":"Statorials","description":"La tua guida all&#039;alfabetizzazione statistica!","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statorials.org\/it\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"it-IT"},{"@type":"Person","@id":"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae","name":"Benjamin anderson","image":{"@type":"ImageObject","inLanguage":"it-IT","@id":"https:\/\/statorials.org\/it\/#\/schema\/person\/image\/","url":"https:\/\/statorials.org\/it\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","contentUrl":"https:\/\/statorials.org\/it\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","caption":"Benjamin anderson"},"description":"Ciao, sono Benjamin, un professore di statistica in pensione diventato insegnante dedicato di Statorials. Con una vasta esperienza e competenza nel campo della statistica, sono ansioso di condividere le mie conoscenze per potenziare gli studenti attraverso Statorials. Scopri di pi\u00f9","sameAs":["https:\/\/statorials.org\/it"]}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/posts\/461"}],"collection":[{"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/comments?post=461"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/posts\/461\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/media?parent=461"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/categories?post=461"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/tags?post=461"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}