{"id":1089,"date":"2023-07-27T17:00:11","date_gmt":"2023-07-27T17:00:11","guid":{"rendered":"https:\/\/statorials.org\/de\/ggplot-kreisdiagramm\/"},"modified":"2023-07-27T17:00:11","modified_gmt":"2023-07-27T17:00:11","slug":"ggplot-kreisdiagramm","status":"publish","type":"post","link":"https:\/\/statorials.org\/de\/ggplot-kreisdiagramm\/","title":{"rendered":"So erstellen sie kreisdiagramme in ggplot2 (mit beispielen)"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">Ein <strong>Kreisdiagramm<\/strong> ist eine Art Kreisdiagramm und verwendet Abschnitte, um die Proportionen eines Ganzen darzustellen.<\/span><\/p>\n<p> <span style=\"color: #000000;\">In diesem Tutorial wird erkl\u00e4rt, wie Sie Kreisdiagramme in R mithilfe der Datenvisualisierungsbibliothek <a href=\"https:\/\/ggplot2.tidyverse.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">ggplot2<\/a> erstellen und bearbeiten.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>So erstellen Sie ein einfaches Kreisdiagramm<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Der folgende Code zeigt, wie man mit ggplot2 ein einfaches Kreisdiagramm f\u00fcr einen Datensatz erstellt:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #993300;\">library<\/span> (ggplot2)\n\n<span style=\"color: #008080;\">#create data frame\n<\/span>data &lt;- data.frame(\" <span style=\"color: #008000;\">category<\/span> \" = c('A', 'B', 'C', 'D'),\n                   \" <span style=\"color: #008000;\">amount<\/span> \" = c(25, 40, 27, 8))\n\n<span style=\"color: #008080;\">#create pie chart<\/span>\nggplot(data, <span style=\"color: #3366ff;\">aes<\/span> (x=\"\", y=amount, fill=category)) +\n  geom_bar(stat=\" <span style=\"color: #008000;\">identity<\/span> \", width= <span style=\"color: #800080;\">1<\/span> ) +\n  coord_polar(\" <span style=\"color: #008000;\">y<\/span> \", start= <span style=\"color: #800080;\">0<\/span> ) \n<\/strong><\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-11154 \" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/tarteggplot2.png\" alt=\"ggplot2 Kreisdiagramm\" width=\"446\" height=\"384\" srcset=\"\" sizes=\"\"><\/p>\n<h3> <span style=\"color: #000000;\"><strong>So \u00e4ndern Sie das Erscheinungsbild des Kreisdiagramms<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Das Standard-Kreisdiagramm in ggplot2 ist ziemlich h\u00e4sslich. Der einfachste Weg, das Erscheinungsbild zu verbessern, ist die Verwendung <strong>von theme_void()<\/strong> , wodurch der Hintergrund, das Raster und die Beschriftungen entfernt werden:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong>ggplot(data, <span style=\"color: #3366ff;\">aes<\/span> (x=\"\", y=amount, fill=category)) +\n  geom_bar(stat=\" <span style=\"color: #008000;\">identity<\/span> \", width= <span style=\"color: #800080;\">1<\/span> ) +\n  coord_polar(\" <span style=\"color: #008000;\">y<\/span> \", start= <span style=\"color: #800080;\">0<\/span> ) +\n  theme_void()<\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-11155 \" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/tarteggplot3.png\" alt=\"ggplot2 Kreisdiagramm ohne Beschriftungen\" width=\"457\" height=\"364\" srcset=\"\" sizes=\"\"><\/p>\n<p> <span style=\"color: #000000;\">Wir k\u00f6nnen das Erscheinungsbild des Diagramms weiter verbessern, indem wir Beschriftungen innerhalb der Slices hinzuf\u00fcgen:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong>ggplot(data, <span style=\"color: #3366ff;\">aes<\/span> (x=\"\", y=amount, fill=category)) +\n  geom_bar(stat=\" <span style=\"color: #008000;\">identity<\/span> \", width= <span style=\"color: #800080;\">1<\/span> ) +\n  coord_polar(\" <span style=\"color: #008000;\">y<\/span> \", start= <span style=\"color: #800080;\">0<\/span> ) +\n  geom_text( <span style=\"color: #3366ff;\">aes<\/span> (label = paste0(amount, \" <span style=\"color: #008000;\">%<\/span> \")), position = position_stack(vjust= <span style=\"color: #800080;\">0.5<\/span> )) +\n  labs(x = NULL, y = NULL, fill = NULL)<\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-11156 \" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/tarteggplot4.png\" alt=\"Kreisdiagramm in ggplot2 mit benutzerdefinierten Beschriftungen\" width=\"487\" height=\"441\" srcset=\"\" sizes=\"\"><\/p>\n<p> <span style=\"color: #000000;\">Wir k\u00f6nnen das Diagramm noch weiter anpassen, indem wir mit dem Argument <strong>\u201escale_fill_manual()\u201c<\/strong> unsere eigenen hexadezimalen Farben angeben, die f\u00fcr die Slices verwendet werden sollen:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong>ggplot(data, <span style=\"color: #3366ff;\">aes<\/span> (x=\"\", y=amount, fill=category)) +\n  geom_bar(stat=\" <span style=\"color: #008000;\">identity<\/span> \", width= <span style=\"color: #800080;\">1<\/span> ) +\n  coord_polar(\" <span style=\"color: #008000;\">y<\/span> \", start= <span style=\"color: #800080;\">0<\/span> ) +\n  geom_text( <span style=\"color: #3366ff;\">aes<\/span> (label = paste0(amount, \" <span style=\"color: #008000;\">%<\/span> \")), position = position_stack(vjust= <span style=\"color: #800080;\">0.5<\/span> )) +\n  labs(x = NULL, y = NULL, fill = NULL) +\n  theme_classic() +\n  theme(axis.line = element_blank(),\n          axis.text = element_blank(),\n          axis.ticks = element_blank()) +\n  scale_fill_manual(values=c(\" <span style=\"color: #008000;\">#FF5733<\/span> \", \" <span style=\"color: #008000;\">#75FF33<\/span> \", \" <span style=\"color: #008000;\">#33DBFF<\/span> \", \" <span style=\"color: #008000;\">#BD33FF<\/span> \"))<\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-11157 \" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/tarteggplot5.png\" alt=\"Kreisdiagramm ggplot2 manuell ma\u00dfstabsgetreu ausf\u00fcllen\" width=\"456\" height=\"361\" srcset=\"\" sizes=\"\"><\/p>\n<p> <span style=\"color: #000000;\"><em><strong>Tipp:<\/strong> Verwenden Sie diesen <a href=\"https:\/\/htmlcolorcodes.com\/color-picker\/\" target=\"_blank\" rel=\"noopener noreferrer\">Hex-Farbw\u00e4hler<\/a> , um Kombinationen von Hex-Farbcodes zu finden, die zusammen gut aussehen.<\/em><\/span><\/p>\n<p> <span style=\"color: #000000;\">Sie k\u00f6nnen die Scheibenfarben auch individuell anpassen, indem Sie einfach eine der <a href=\"https:\/\/ggplot2.tidyverse.org\/reference\/scale_brewer.html\" target=\"_blank\" rel=\"noopener noreferrer\">Farbskalen des Brauers<\/a> ausw\u00e4hlen. So sieht beispielsweise die Farbskala \u201eBlau\u201c aus:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong>ggplot(data, <span style=\"color: #3366ff;\">aes<\/span> (x=\"\", y=amount, fill=category)) +\n  geom_bar(stat=\" <span style=\"color: #008000;\">identity<\/span> \", width= <span style=\"color: #800080;\">1<\/span> ) +\n  coord_polar(\" <span style=\"color: #008000;\">y<\/span> \", start= <span style=\"color: #800080;\">0<\/span> ) +\n  geom_text( <span style=\"color: #3366ff;\">aes<\/span> (label = paste0(amount, \" <span style=\"color: #008000;\">%<\/span> \")), position = position_stack(vjust= <span style=\"color: #800080;\">0.5<\/span> )) +\n  labs(x = NULL, y = NULL) +\n  theme_classic() +\n  theme(axis.line = element_blank(),\n          axis.text = element_blank(),\n          axis.ticks = element_blank()) +\n  scale_fill_brewer(palette=\" <span style=\"color: #008000;\">Blues<\/span> \")<\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-11158 \" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/tarteggplot6.png\" alt=\"Brauer im Ma\u00dfstab in ggplot2\" width=\"484\" height=\"376\" srcset=\"\" sizes=\"\"><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Zus\u00e4tzliche Ressourcen<\/strong><\/span><\/h3>\n<p> <a href=\"https:\/\/statorials.org\/de\/gruppierter-boxplot-r-ggplot2\/\" target=\"_blank\" rel=\"noopener noreferrer\">So erstellen Sie einen gruppierten Boxplot in R mit ggplot2<\/a><br \/> <a href=\"https:\/\/statorials.org\/de\/heatmap-r-ggplot2\/\" target=\"_blank\" rel=\"noopener noreferrer\">So erstellen Sie eine Heatmap in R mit ggplot2<\/a><br \/> <a href=\"https:\/\/statorials.org\/de\/gantt-diagramm-r-ggplot2\/\" target=\"_blank\" rel=\"noopener noreferrer\">So erstellen Sie ein Gantt-Diagramm in R mit ggplot2<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ein Kreisdiagramm ist eine Art Kreisdiagramm und verwendet Abschnitte, um die Proportionen eines Ganzen darzustellen. In diesem Tutorial wird erkl\u00e4rt, wie Sie Kreisdiagramme in R mithilfe der Datenvisualisierungsbibliothek ggplot2 erstellen und bearbeiten. So erstellen Sie ein einfaches Kreisdiagramm Der folgende Code zeigt, wie man mit ggplot2 ein einfaches Kreisdiagramm f\u00fcr einen Datensatz erstellt: library (ggplot2) [&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>So erstellen Sie Kreisdiagramme in ggplot2 (mit Beispielen)<\/title>\n<meta name=\"description\" content=\"In diesem Tutorial wird erl\u00e4utert, wie Sie mithilfe der ggplot2-Bibliothek Kreisdiagramme in R erstellen und bearbeiten.\" \/>\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\/de\/ggplot-kreisdiagramm\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"So erstellen Sie Kreisdiagramme in ggplot2 (mit Beispielen)\" \/>\n<meta property=\"og:description\" content=\"In diesem Tutorial wird erl\u00e4utert, wie Sie mithilfe der ggplot2-Bibliothek Kreisdiagramme in R erstellen und bearbeiten.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/de\/ggplot-kreisdiagramm\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-27T17:00:11+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/tarteggplot2.png\" \/>\n<meta name=\"author\" content=\"Dr. Benjamin Anderson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Verfasst von\" \/>\n\t<meta name=\"twitter:data1\" content=\"Dr. Benjamin Anderson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Gesch\u00e4tzte Lesezeit\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 Minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/de\/ggplot-kreisdiagramm\/\",\"url\":\"https:\/\/statorials.org\/de\/ggplot-kreisdiagramm\/\",\"name\":\"So erstellen Sie Kreisdiagramme in ggplot2 (mit Beispielen)\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/de\/#website\"},\"datePublished\":\"2023-07-27T17:00:11+00:00\",\"dateModified\":\"2023-07-27T17:00:11+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0\"},\"description\":\"In diesem Tutorial wird erl\u00e4utert, wie Sie mithilfe der ggplot2-Bibliothek Kreisdiagramme in R erstellen und bearbeiten.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/de\/ggplot-kreisdiagramm\/#breadcrumb\"},\"inLanguage\":\"de-DE\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/de\/ggplot-kreisdiagramm\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/de\/ggplot-kreisdiagramm\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Heim\",\"item\":\"https:\/\/statorials.org\/de\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"So erstellen sie kreisdiagramme in ggplot2 (mit beispielen)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statorials.org\/de\/#website\",\"url\":\"https:\/\/statorials.org\/de\/\",\"name\":\"Statorials\",\"description\":\"Ihr Leitfaden f\u00fcr statistische Kompetenz !\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statorials.org\/de\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"de-DE\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0\",\"name\":\"Dr. Benjamin Anderson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de-DE\",\"@id\":\"https:\/\/statorials.org\/de\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/statorials.org\/de\/wp-content\/uploads\/2023\/11\/Benjamin-Anderson-96x96.jpg\",\"contentUrl\":\"https:\/\/statorials.org\/de\/wp-content\/uploads\/2023\/11\/Benjamin-Anderson-96x96.jpg\",\"caption\":\"Dr. Benjamin Anderson\"},\"description\":\"Hallo, ich bin Benjamin, ein pensionierter Statistikprofessor, der sich zum engagierten Statorials-Lehrer entwickelt hat. Mit umfassender Erfahrung und Fachwissen auf dem Gebiet der Statistik bin ich bestrebt, mein Wissen zu teilen, um Studenten durch Statorials zu bef\u00e4higen. Mehr wissen\",\"sameAs\":[\"https:\/\/statorials.org\/de\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"So erstellen Sie Kreisdiagramme in ggplot2 (mit Beispielen)","description":"In diesem Tutorial wird erl\u00e4utert, wie Sie mithilfe der ggplot2-Bibliothek Kreisdiagramme in R erstellen und bearbeiten.","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\/de\/ggplot-kreisdiagramm\/","og_locale":"de_DE","og_type":"article","og_title":"So erstellen Sie Kreisdiagramme in ggplot2 (mit Beispielen)","og_description":"In diesem Tutorial wird erl\u00e4utert, wie Sie mithilfe der ggplot2-Bibliothek Kreisdiagramme in R erstellen und bearbeiten.","og_url":"https:\/\/statorials.org\/de\/ggplot-kreisdiagramm\/","og_site_name":"Statorials","article_published_time":"2023-07-27T17:00:11+00:00","og_image":[{"url":"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/tarteggplot2.png"}],"author":"Dr. Benjamin Anderson","twitter_card":"summary_large_image","twitter_misc":{"Verfasst von":"Dr. Benjamin Anderson","Gesch\u00e4tzte Lesezeit":"2 Minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/de\/ggplot-kreisdiagramm\/","url":"https:\/\/statorials.org\/de\/ggplot-kreisdiagramm\/","name":"So erstellen Sie Kreisdiagramme in ggplot2 (mit Beispielen)","isPartOf":{"@id":"https:\/\/statorials.org\/de\/#website"},"datePublished":"2023-07-27T17:00:11+00:00","dateModified":"2023-07-27T17:00:11+00:00","author":{"@id":"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0"},"description":"In diesem Tutorial wird erl\u00e4utert, wie Sie mithilfe der ggplot2-Bibliothek Kreisdiagramme in R erstellen und bearbeiten.","breadcrumb":{"@id":"https:\/\/statorials.org\/de\/ggplot-kreisdiagramm\/#breadcrumb"},"inLanguage":"de-DE","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/de\/ggplot-kreisdiagramm\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/de\/ggplot-kreisdiagramm\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Heim","item":"https:\/\/statorials.org\/de\/"},{"@type":"ListItem","position":2,"name":"So erstellen sie kreisdiagramme in ggplot2 (mit beispielen)"}]},{"@type":"WebSite","@id":"https:\/\/statorials.org\/de\/#website","url":"https:\/\/statorials.org\/de\/","name":"Statorials","description":"Ihr Leitfaden f\u00fcr statistische Kompetenz !","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statorials.org\/de\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"de-DE"},{"@type":"Person","@id":"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0","name":"Dr. Benjamin Anderson","image":{"@type":"ImageObject","inLanguage":"de-DE","@id":"https:\/\/statorials.org\/de\/#\/schema\/person\/image\/","url":"https:\/\/statorials.org\/de\/wp-content\/uploads\/2023\/11\/Benjamin-Anderson-96x96.jpg","contentUrl":"https:\/\/statorials.org\/de\/wp-content\/uploads\/2023\/11\/Benjamin-Anderson-96x96.jpg","caption":"Dr. Benjamin Anderson"},"description":"Hallo, ich bin Benjamin, ein pensionierter Statistikprofessor, der sich zum engagierten Statorials-Lehrer entwickelt hat. Mit umfassender Erfahrung und Fachwissen auf dem Gebiet der Statistik bin ich bestrebt, mein Wissen zu teilen, um Studenten durch Statorials zu bef\u00e4higen. Mehr wissen","sameAs":["https:\/\/statorials.org\/de"]}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/posts\/1089"}],"collection":[{"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/comments?post=1089"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/posts\/1089\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/media?parent=1089"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/categories?post=1089"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/tags?post=1089"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}