{"id":3988,"date":"2023-07-14T07:58:17","date_gmt":"2023-07-14T07:58:17","guid":{"rendered":"https:\/\/statorials.org\/de\/ggplot-pfeile\/"},"modified":"2023-07-14T07:58:17","modified_gmt":"2023-07-14T07:58:17","slug":"ggplot-pfeile","status":"publish","type":"post","link":"https:\/\/statorials.org\/de\/ggplot-pfeile\/","title":{"rendered":"So zeichnen sie pfeile in ggplot2 (mit beispielen)"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">Sie k\u00f6nnen die folgende grundlegende Syntax verwenden, um in ggplot2 einen Pfeil in einem Diagramm zu zeichnen:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008000;\">library<\/span> (ggplot2)\n\nggplot(df, aes(x=x, y=y)) +\n  geom_point() +\n  geom_segment(aes(x= <span style=\"color: #008000;\">5<\/span> , y= <span style=\"color: #008000;\">6<\/span> , xend= <span style=\"color: #008000;\">8<\/span> , yend= <span style=\"color: #008000;\">9<\/span> ), arrow = arrow(length=unit( <span style=\"color: #008000;\">0.5<\/span> , ' <span style=\"color: #ff0000;\">cm<\/span> ')))\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Hier ist, was jedes Argument in der Funktion <strong>geom_segment()<\/strong> bewirkt:<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\"><strong>x<\/strong> : Der x-Wert, bei dem begonnen werden soll<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>y<\/strong> : Der y-Wert, bei dem begonnen werden soll<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>xend<\/strong> : Der x-Wert, bei dem enden soll<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>yend<\/strong> : Der y-Wert, bei dem enden soll<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>Pfeil<\/strong> : Die L\u00e4nge der Pfeilspitze<\/span><\/li>\n<\/ul>\n<p> <span style=\"color: #000000;\">Das folgende Beispiel zeigt, wie man mit ggplot2 in der Praxis einen Pfeil zeichnet.<\/span><\/p>\n<h2> <span style=\"color: #000000;\"><strong>Beispiel: Zeichnen von Pfeilen in ggplot2<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">Angenommen, wir verf\u00fcgen \u00fcber die folgende Datenbank mit Informationen \u00fcber die Anzahl der erzielten Punkte und Rebounds verschiedener Basketballspieler:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#create data frame\n<\/span>df &lt;- data. <span style=\"color: #3366ff;\">frame<\/span> (points=c(3, 3, 5, 6, 7, 8, 9, 9, 8, 5),\n                 rebounds=c(2, 6, 5, 5, 8, 5, 9, 9, 8, 6))\n\n<span style=\"color: #008080;\">#view data frame\n<\/span>df\n\n   rebound points\n1 3 2\n2 3 6\n3 5 5\n4 6 5\n5 7 8\n6 8 5\n7 9 9\n8 9 9\n9 8 8\n10 5 6<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Wir k\u00f6nnen die folgende Syntax verwenden, um ein Streudiagramm in ggplot2 zu erstellen und einen Pfeil an einer bestimmten Stelle im Diagramm hinzuzuf\u00fcgen:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008000;\">library<\/span> (ggplot2)\n\n<span style=\"color: #008080;\">#create scatterplot and add arrow\n<\/span>ggplot(df, aes(x=points, y=rebounds)) +\n  geom_point() +\n  geom_segment(aes(x= <span style=\"color: #008000;\">5<\/span> , y= <span style=\"color: #008000;\">6<\/span> , xend= <span style=\"color: #008000;\">8<\/span> , yend= <span style=\"color: #008000;\">9<\/span> ), arrow = arrow(length=unit( <span style=\"color: #008000;\">.5<\/span> , ' <span style=\"color: #ff0000;\">cm<\/span> ')))<\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-31935\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/fleche1.jpg\" alt=\"Zeichne einen Pfeil in ggplot2\" width=\"560\" height=\"441\" srcset=\"\" sizes=\"\"><\/p>\n<p> <span style=\"color: #000000;\">F\u00fchlen Sie sich frei, den Wert in der Funktion <strong>\u201earrow()\u201c<\/strong> zu \u00e4ndern, um die Gr\u00f6\u00dfe der Pfeilspitze zu vergr\u00f6\u00dfern oder zu verkleinern.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Der folgende Code zeigt beispielsweise, wie die Gr\u00f6\u00dfe erh\u00f6ht wird:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008000;\">library<\/span> (ggplot2)\n\n<span style=\"color: #008080;\">#create scatterplot and add arrow with increased arrow head size\n<\/span>ggplot(df, aes(x=points, y=rebounds)) +\n  geom_point() +\n  geom_segment(aes(x= <span style=\"color: #008000;\">5<\/span> , y= <span style=\"color: #008000;\">6<\/span> , xend= <span style=\"color: #008000;\">8<\/span> , yend= <span style=\"color: #008000;\">9<\/span> ), arrow = arrow(length=unit( <span style=\"color: #008000;\">2<\/span> , ' <span style=\"color: #ff0000;\">cm<\/span> ')))<\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-31936 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/fleche2.jpg\" alt=\"\" width=\"550\" height=\"431\" srcset=\"\" sizes=\"\"><\/p>\n<p> <span style=\"color: #000000;\">Sie k\u00f6nnen auch die Argumente <strong>color<\/strong> und <strong>lwd<\/strong> verwenden, um die Farbe bzw. die Linienst\u00e4rke des Pfeils zu \u00e4ndern:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008000;\">library<\/span> (ggplot2)\n\n<span style=\"color: #008080;\">#create scatterplot and add customized arrow\n<\/span>ggplot(df, aes(x=points, y=rebounds)) +\n  geom_point() +\n  geom_segment(aes(x= <span style=\"color: #008000;\">5<\/span> , y= <span style=\"color: #008000;\">6<\/span> , xend= <span style=\"color: #008000;\">8<\/span> , yend= <span style=\"color: #008000;\">9<\/span> ), arrow = arrow(length=unit( <span style=\"color: #008000;\">.5<\/span> , ' <span style=\"color: #ff0000;\">cm<\/span> ')),\n               color=' <span style=\"color: #ff0000;\">red<\/span> ', lwd= <span style=\"color: #008000;\">3<\/span> )<\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-31937 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/fleche3.jpg\" alt=\"\" width=\"565\" height=\"440\" srcset=\"\" sizes=\"\"><\/p>\n<p> <span style=\"color: #000000;\">Probieren Sie ruhig die verschiedenen Argumente der Funktion <strong>geom_segment()<\/strong> aus, um einen Pfeil zu erstellen, der genau Ihren Vorstellungen entspricht.<\/span><\/p>\n<h2> <span style=\"color: #000000;\"><strong>Zus\u00e4tzliche Ressourcen<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">Die folgenden Tutorials erkl\u00e4ren, wie Sie andere h\u00e4ufige Aufgaben in ggplot2 ausf\u00fchren:<\/span><\/p>\n<p> So entfernen Sie Gitterlinien in ggplot2<br \/> <a href=\"https:\/\/statorials.org\/de\/ggplot2-schattierter-bereich\/\" target=\"_blank\" rel=\"noopener\">So schattieren Sie einen Bereich in ggplot2<\/a><br \/> <a href=\"https:\/\/statorials.org\/de\/ggplot-andert-die-beschriftungen-der-x-achse\/\" target=\"_blank\" rel=\"noopener\">So \u00e4ndern Sie die X-Achsenbeschriftung in ggplot2<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sie k\u00f6nnen die folgende grundlegende Syntax verwenden, um in ggplot2 einen Pfeil in einem Diagramm zu zeichnen: library (ggplot2) ggplot(df, aes(x=x, y=y)) + geom_point() + geom_segment(aes(x= 5 , y= 6 , xend= 8 , yend= 9 ), arrow = arrow(length=unit( 0.5 , &#8218; cm &#8218;))) Hier ist, was jedes Argument in der Funktion geom_segment() bewirkt: [&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 zeichnen Sie Pfeile in ggplot2 (mit Beispielen) \u2013 Statistik<\/title>\n<meta name=\"description\" content=\"In diesem Tutorial wird anhand eines Beispiels erl\u00e4utert, wie Pfeile in einem Plot in ggplot2 gezeichnet werden.\" \/>\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-pfeile\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"So zeichnen Sie Pfeile in ggplot2 (mit Beispielen) \u2013 Statistik\" \/>\n<meta property=\"og:description\" content=\"In diesem Tutorial wird anhand eines Beispiels erl\u00e4utert, wie Pfeile in einem Plot in ggplot2 gezeichnet werden.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/de\/ggplot-pfeile\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-14T07:58:17+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/fleche1.jpg\" \/>\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-pfeile\/\",\"url\":\"https:\/\/statorials.org\/de\/ggplot-pfeile\/\",\"name\":\"So zeichnen Sie Pfeile in ggplot2 (mit Beispielen) \u2013 Statistik\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/de\/#website\"},\"datePublished\":\"2023-07-14T07:58:17+00:00\",\"dateModified\":\"2023-07-14T07:58:17+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0\"},\"description\":\"In diesem Tutorial wird anhand eines Beispiels erl\u00e4utert, wie Pfeile in einem Plot in ggplot2 gezeichnet werden.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/de\/ggplot-pfeile\/#breadcrumb\"},\"inLanguage\":\"de-DE\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/de\/ggplot-pfeile\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/de\/ggplot-pfeile\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Heim\",\"item\":\"https:\/\/statorials.org\/de\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"So zeichnen sie pfeile 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 zeichnen Sie Pfeile in ggplot2 (mit Beispielen) \u2013 Statistik","description":"In diesem Tutorial wird anhand eines Beispiels erl\u00e4utert, wie Pfeile in einem Plot in ggplot2 gezeichnet werden.","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-pfeile\/","og_locale":"de_DE","og_type":"article","og_title":"So zeichnen Sie Pfeile in ggplot2 (mit Beispielen) \u2013 Statistik","og_description":"In diesem Tutorial wird anhand eines Beispiels erl\u00e4utert, wie Pfeile in einem Plot in ggplot2 gezeichnet werden.","og_url":"https:\/\/statorials.org\/de\/ggplot-pfeile\/","og_site_name":"Statorials","article_published_time":"2023-07-14T07:58:17+00:00","og_image":[{"url":"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/fleche1.jpg"}],"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-pfeile\/","url":"https:\/\/statorials.org\/de\/ggplot-pfeile\/","name":"So zeichnen Sie Pfeile in ggplot2 (mit Beispielen) \u2013 Statistik","isPartOf":{"@id":"https:\/\/statorials.org\/de\/#website"},"datePublished":"2023-07-14T07:58:17+00:00","dateModified":"2023-07-14T07:58:17+00:00","author":{"@id":"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0"},"description":"In diesem Tutorial wird anhand eines Beispiels erl\u00e4utert, wie Pfeile in einem Plot in ggplot2 gezeichnet werden.","breadcrumb":{"@id":"https:\/\/statorials.org\/de\/ggplot-pfeile\/#breadcrumb"},"inLanguage":"de-DE","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/de\/ggplot-pfeile\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/de\/ggplot-pfeile\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Heim","item":"https:\/\/statorials.org\/de\/"},{"@type":"ListItem","position":2,"name":"So zeichnen sie pfeile 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\/3988"}],"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=3988"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/posts\/3988\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/media?parent=3988"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/categories?post=3988"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/tags?post=3988"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}