{"id":1833,"date":"2023-07-24T19:29:27","date_gmt":"2023-07-24T19:29:27","guid":{"rendered":"https:\/\/statorials.org\/de\/ggplot-horizontale-linie\/"},"modified":"2023-07-24T19:29:27","modified_gmt":"2023-07-24T19:29:27","slug":"ggplot-horizontale-linie","status":"publish","type":"post","link":"https:\/\/statorials.org\/de\/ggplot-horizontale-linie\/","title":{"rendered":"So f\u00fcgen sie mit ggplot2 eine horizontale linie zu einem diagramm hinzu"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">Mit der Funktion <strong>geom_hline()<\/strong> , die die folgende Syntax verwendet, k\u00f6nnen Sie schnell horizontale Linien zu ggplot2-Plots hinzuf\u00fcgen:<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>geom_hline(yintercept, linetype, color, size)<\/strong><\/span><\/p>\n<p> <span style=\"color: #000000;\">Gold:<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\"><strong>Y-Achsenabschnitt:<\/strong> Ort, an dem eine Linie auf dem Y-Achsenabschnitt hinzugef\u00fcgt werden soll.<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>Linientyp:<\/strong> Linienstil. Der Standardwert ist \u201esolid\u201c, aber Sie k\u00f6nnen \u201etwodash\u201c, \u201elongdash\u201c, \u201edotted\u201c, \u201edotdash\u201c, \u201edash\u201c oder \u201eblank\u201c angeben.<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>Farbe:<\/strong> Farbe der Linie.<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>Gr\u00f6\u00dfe:<\/strong> Breite der Linie.<\/span><\/li>\n<\/ul>\n<p> <span style=\"color: #000000;\">Die folgenden Beispiele zeigen, wie Sie diese Funktion in der Praxis nutzen k\u00f6nnen.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>F\u00fcgen Sie einem Pfad eine einzelne horizontale Linie hinzu<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Der folgende Code zeigt, wie man einem Diagramm eine einzelne horizontale Linie hinzuf\u00fcgt:<\/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<\/span> \ndf &lt;- data. <span style=\"color: #3366ff;\">frame<\/span> (x=c(1, 3, 3, 4, 5, 5, 6, 9, 12, 15),\n                 y=c(13, 14, 14, 12, 17, 21, 22, 28, 30, 31))\n\n<span style=\"color: #008080;\">#create scatterplot with horizontal line at y=20<\/span>\nggplot(df, <span style=\"color: #3366ff;\">aes<\/span> (x=x, y=y)) +\n  geom_point() +\n  geom_hline(yintercept= <span style=\"color: #008000;\">20<\/span> )\n<\/strong><\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-17741\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/horizgg1.png\" alt=\"Horizontale Linie in ggplot2\" width=\"471\" height=\"465\" srcset=\"\" sizes=\"\"><\/p>\n<h3> <span style=\"color: #000000;\"><strong>F\u00fcgen Sie den Pfaden mehrere horizontale Linien hinzu<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Der folgende Code zeigt, wie man einem Diagramm mehrere horizontale Linien hinzuf\u00fcgt:<\/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<\/span> \ndf &lt;- data. <span style=\"color: #3366ff;\">frame<\/span> (x=c(1, 3, 3, 4, 5, 5, 6, 9, 12, 15),\n                 y=c(13, 14, 14, 12, 17, 21, 22, 28, 30, 31))\n\n<span style=\"color: #008080;\">#create scatterplot with horizontal lines at y = 10, 20, 30<\/span>\nggplot(df, <span style=\"color: #3366ff;\">aes<\/span> (x=x, y=y)) +\n  geom_point() +\n  geom_hline(yintercept=c( <span style=\"color: #008000;\">10, 20, 30<\/span> ))<\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-17742 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/horizgg2.png\" alt=\"\" width=\"467\" height=\"474\" srcset=\"\" sizes=\"\"><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Passen Sie horizontale Linien an<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Der folgende Code zeigt, wie horizontale Linien in einem Diagramm angepasst werden:<\/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<\/span> \ndf &lt;- data. <span style=\"color: #3366ff;\">frame<\/span> (x=c(1, 3, 3, 4, 5, 5, 6, 9, 12, 15),\n                 y=c(13, 14, 14, 12, 17, 21, 22, 28, 30, 31))\n\n<span style=\"color: #008080;\">#create scatterplot with customized horizontal lines<\/span>\nggplot(df, <span style=\"color: #3366ff;\">aes<\/span> (x=x, y=y)) +\n  geom_point() +\n  geom_hline(yintercept=c( <span style=\"color: #008000;\">20 <span style=\"color: #000000;\">,<\/span> 30 <span style=\"color: #000000;\">)<\/span><\/span> , linetype=' <span style=\"color: #008000;\">dashed<\/span> ', color=c(' <span style=\"color: #008000;\">blue<\/span> ', ' <span style=\"color: #008000;\">red<\/span> '))<\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-17743\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/horizgg3.png\" alt=\"Mehrere horizontale Linien in ggplot2\" width=\"469\" height=\"471\" srcset=\"\" sizes=\"\"><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Zus\u00e4tzliche Ressourcen<\/strong><\/span><\/h3>\n<p> <a href=\"https:\/\/statorials.org\/de\/ggplot2-vertikale-linie\/\" target=\"_blank\" rel=\"noopener\">So f\u00fcgen Sie mit ggplot2 eine vertikale Linie zu einem Diagramm hinzu<\/a><br \/> <a href=\"https:\/\/statorials.org\/de\/ggplot2-lineare-regression\/\" target=\"_blank\" rel=\"noopener noreferrer\">So zeichnen Sie eine lineare Regressionslinie in ggplot2<\/a><br \/> <a href=\"https:\/\/statorials.org\/de\/legen-sie-die-achsengrenzen-fur-ggplot2-fest\/\" target=\"_blank\" rel=\"noopener noreferrer\">So legen Sie Achsengrenzen in ggplot2 fest<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Mit der Funktion geom_hline() , die die folgende Syntax verwendet, k\u00f6nnen Sie schnell horizontale Linien zu ggplot2-Plots hinzuf\u00fcgen: geom_hline(yintercept, linetype, color, size) Gold: Y-Achsenabschnitt: Ort, an dem eine Linie auf dem Y-Achsenabschnitt hinzugef\u00fcgt werden soll. Linientyp: Linienstil. Der Standardwert ist \u201esolid\u201c, aber Sie k\u00f6nnen \u201etwodash\u201c, \u201elongdash\u201c, \u201edotted\u201c, \u201edotdash\u201c, \u201edash\u201c oder \u201eblank\u201c angeben. Farbe: Farbe der [&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 f\u00fcgen Sie mit ggplot2 eine horizontale Linie zu einem Diagramm hinzu<\/title>\n<meta name=\"description\" content=\"In diesem Tutorial wird anhand mehrerer Beispiele erkl\u00e4rt, wie man mit ggplot2 eine horizontale Linie zu einem Diagramm in R hinzuf\u00fcgt.\" \/>\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-horizontale-linie\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"So f\u00fcgen Sie mit ggplot2 eine horizontale Linie zu einem Diagramm hinzu\" \/>\n<meta property=\"og:description\" content=\"In diesem Tutorial wird anhand mehrerer Beispiele erkl\u00e4rt, wie man mit ggplot2 eine horizontale Linie zu einem Diagramm in R hinzuf\u00fcgt.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/de\/ggplot-horizontale-linie\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-24T19:29:27+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/horizgg1.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=\"1 Minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/de\/ggplot-horizontale-linie\/\",\"url\":\"https:\/\/statorials.org\/de\/ggplot-horizontale-linie\/\",\"name\":\"So f\u00fcgen Sie mit ggplot2 eine horizontale Linie zu einem Diagramm hinzu\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/de\/#website\"},\"datePublished\":\"2023-07-24T19:29:27+00:00\",\"dateModified\":\"2023-07-24T19:29:27+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0\"},\"description\":\"In diesem Tutorial wird anhand mehrerer Beispiele erkl\u00e4rt, wie man mit ggplot2 eine horizontale Linie zu einem Diagramm in R hinzuf\u00fcgt.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/de\/ggplot-horizontale-linie\/#breadcrumb\"},\"inLanguage\":\"de-DE\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/de\/ggplot-horizontale-linie\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/de\/ggplot-horizontale-linie\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Heim\",\"item\":\"https:\/\/statorials.org\/de\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"So f\u00fcgen sie mit ggplot2 eine horizontale linie zu einem diagramm hinzu\"}]},{\"@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 f\u00fcgen Sie mit ggplot2 eine horizontale Linie zu einem Diagramm hinzu","description":"In diesem Tutorial wird anhand mehrerer Beispiele erkl\u00e4rt, wie man mit ggplot2 eine horizontale Linie zu einem Diagramm in R hinzuf\u00fcgt.","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-horizontale-linie\/","og_locale":"de_DE","og_type":"article","og_title":"So f\u00fcgen Sie mit ggplot2 eine horizontale Linie zu einem Diagramm hinzu","og_description":"In diesem Tutorial wird anhand mehrerer Beispiele erkl\u00e4rt, wie man mit ggplot2 eine horizontale Linie zu einem Diagramm in R hinzuf\u00fcgt.","og_url":"https:\/\/statorials.org\/de\/ggplot-horizontale-linie\/","og_site_name":"Statorials","article_published_time":"2023-07-24T19:29:27+00:00","og_image":[{"url":"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/horizgg1.png"}],"author":"Dr. Benjamin Anderson","twitter_card":"summary_large_image","twitter_misc":{"Verfasst von":"Dr. Benjamin Anderson","Gesch\u00e4tzte Lesezeit":"1 Minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/de\/ggplot-horizontale-linie\/","url":"https:\/\/statorials.org\/de\/ggplot-horizontale-linie\/","name":"So f\u00fcgen Sie mit ggplot2 eine horizontale Linie zu einem Diagramm hinzu","isPartOf":{"@id":"https:\/\/statorials.org\/de\/#website"},"datePublished":"2023-07-24T19:29:27+00:00","dateModified":"2023-07-24T19:29:27+00:00","author":{"@id":"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0"},"description":"In diesem Tutorial wird anhand mehrerer Beispiele erkl\u00e4rt, wie man mit ggplot2 eine horizontale Linie zu einem Diagramm in R hinzuf\u00fcgt.","breadcrumb":{"@id":"https:\/\/statorials.org\/de\/ggplot-horizontale-linie\/#breadcrumb"},"inLanguage":"de-DE","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/de\/ggplot-horizontale-linie\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/de\/ggplot-horizontale-linie\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Heim","item":"https:\/\/statorials.org\/de\/"},{"@type":"ListItem","position":2,"name":"So f\u00fcgen sie mit ggplot2 eine horizontale linie zu einem diagramm hinzu"}]},{"@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\/1833"}],"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=1833"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/posts\/1833\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/media?parent=1833"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/categories?post=1833"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/tags?post=1833"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}