{"id":3355,"date":"2023-07-17T22:37:41","date_gmt":"2023-07-17T22:37:41","guid":{"rendered":"https:\/\/statorials.org\/nl\/ggplot-lijntype\/"},"modified":"2023-07-17T22:37:41","modified_gmt":"2023-07-17T22:37:41","slug":"ggplot-lijntype","status":"publish","type":"post","link":"https:\/\/statorials.org\/nl\/ggplot-lijntype\/","title":{"rendered":"Hoe het lijntype in ggplot2 te veranderen"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">U kunt het <b>lijntype-<\/b> argument gebruiken om het lijntype in een ggplot2-plot te wijzigen:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong>ggplot(df, aes(x=x, y=y)) +\n  geom_line(linetype= <span style=\"color: #008000;\">1<\/span> )<\/strong><\/span><\/pre>\n<p> <span style=\"color: #000000;\">De standaardwaarde voor het lijntype is <strong>1<\/strong> (\u00e9\u00e9n doorgetrokken lijn), maar u kunt elke waarde tussen <strong>0<\/strong> en <strong>6<\/strong> opgeven, waarbij:<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\"><strong>0<\/strong> = leeg<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>1<\/strong> = stevig<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>2<\/strong> = gestippeld<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>3<\/strong> = gestippeld<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>4<\/strong> = streepje<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>5<\/strong> = lang streepje<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>6<\/strong> = twee streepjes<\/span><\/li>\n<\/ul>\n<p> <span style=\"color: #000000;\">De<\/span> <span style=\"color: #000000;\">volgende voorbeelden laten zien hoe u het <b>lijntype-<\/b> argument in verschillende ggplot2-plots kunt wijzigen.<\/span><\/p>\n<h2> <span style=\"color: #000000;\"><strong>Voorbeeld 1: Maak een plot met het standaard lijntype<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">De volgende code laat zien hoe u een lijnplot maakt in ggplot2 met behulp van het standaardlijntype (ononderbroken lijn):<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #008000;\">library<\/span> (ggplot2)\n\n<span style=\"color: #008080;\">#create data frame\n<\/span>df &lt;- data. <span style=\"color: #3366ff;\">frame<\/span> (x=c(1, 2, 4, 5, 8, 9),\n                 y=c(5, 8, 10, 14, 13, 19))\n\n<span style=\"color: #008080;\">#create line plot\n<\/span>ggplot(df, aes(x=x, y=y)) +\n  geom_line()<\/strong><\/span> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-28183 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/type-de-ligne1.jpg\" alt=\"\" width=\"477\" height=\"483\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\">Omdat we het <b>lijntype-<\/b> argument helemaal niet gebruikten, gebruikte ggplot2 het standaardlijntype, effen.<\/span><\/p>\n<h2> <span style=\"color: #000000;\"><strong>Voorbeeld 2: Maak een plot met een aangepast lijntype<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">De volgende code laat zien hoe u een lijnplot maakt in ggplot2 met behulp van stippellijnen (linetype=2) voor het lijntype:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #008000;\">library<\/span> (ggplot2)\n\n<span style=\"color: #008080;\">#create data frame\n<\/span>df &lt;- data. <span style=\"color: #3366ff;\">frame<\/span> (x=c(1, 2, 4, 5, 8, 9),\n                 y=c(5, 8, 10, 14, 13, 19))\n\n<span style=\"color: #008080;\">#create line plot with custom line type\n<\/span>ggplot(df, aes(x=x, y=y)) +\n  geom_line(linetype= <span style=\"color: #008000;\">2<\/span> )<\/strong><\/span> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-28184 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/type-de-ligne2.jpg\" alt=\"\" width=\"471\" height=\"473\" srcset=\"\" sizes=\"auto, \"><\/p>\n<h2> <span style=\"color: #000000;\"><strong>Voorbeeld 3: Maak een plot met een op variabelen gebaseerd lijntype<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">De volgende code laat zien hoe u een lijnplot maakt in ggplot2 waarbij het lijntype is gebaseerd op de waarde van een bepaalde variabele in het dataframe:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #008000;\">library<\/span> (ggplot2)\n\n<span style=\"color: #008080;\">#create data frame\n<\/span>df &lt;- data. <span style=\"color: #3366ff;\">frame<\/span> (x=c(1, 10, 1, 10, 1, 10),\n                 y=c(5, 8, 10, 14, 13, 19),\n                 group=c('A', 'A', 'B', 'B', 'C', 'C'))\n\n<span style=\"color: #008080;\">#create line plot\n<\/span>ggplot(df, aes(x=x, y=y, group=group)) +\n  geom_line(aes(linetype=group, color=group), size= <span style=\"color: #008000;\">1.5<\/span> )<\/strong><\/span> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-28187 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/type-de-ligne3.jpg\" alt=\"\" width=\"469\" height=\"462\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\">Houd er rekening mee dat het lijntype en de kleur van elke lijn gebaseerd zijn op de waarde van de <strong>groepsvariabele<\/strong> .<\/span><\/p>\n<p> <span style=\"color: #000000;\">Merk op dat ggplot2 ook automatisch een legenda aan de rechterkant van de plot produceert om aan te geven welke lijn overeenkomt met welk team.<\/span><\/p>\n<h2> <span style=\"color: #000000;\"><strong>Aanvullende bronnen<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">In de volgende tutorials wordt uitgelegd hoe u andere veelvoorkomende bewerkingen in ggplot2 uitvoert:<\/span><\/p>\n<p> <a href=\"https:\/\/statorials.org\/nl\/ggplot-puntvorm\/\" target=\"_blank\" rel=\"noopener\">Hoe de puntvorm in ggplot2 te veranderen<\/a><br \/> <a href=\"https:\/\/statorials.org\/nl\/ggplot-puntgrootte\/\" target=\"_blank\" rel=\"noopener\">Hoe de puntgrootte in ggplot2 te veranderen<\/a><br \/> <a href=\"https:\/\/statorials.org\/nl\/ggplot2-lijnkleur-wijzigen\/\" target=\"_blank\" rel=\"noopener\">Hoe lijnkleuren in ggplot2 te veranderen<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>U kunt het lijntype- argument gebruiken om het lijntype in een ggplot2-plot te wijzigen: ggplot(df, aes(x=x, y=y)) + geom_line(linetype= 1 ) De standaardwaarde voor het lijntype is 1 (\u00e9\u00e9n doorgetrokken lijn), maar u kunt elke waarde tussen 0 en 6 opgeven, waarbij: 0 = leeg 1 = stevig 2 = gestippeld 3 = gestippeld 4 [&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":[],"class_list":["post-3355","post","type-post","status-publish","format-standard","hentry","category-gids"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Hoe het lijntype in ggplot2 te veranderen \u2013 Statorials<\/title>\n<meta name=\"description\" content=\"In deze tutorial wordt uitgelegd hoe u het lijntype in ggplot2 kunt wijzigen, met verschillende voorbeelden.\" \/>\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\/nl\/ggplot-lijntype\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Hoe het lijntype in ggplot2 te veranderen \u2013 Statorials\" \/>\n<meta property=\"og:description\" content=\"In deze tutorial wordt uitgelegd hoe u het lijntype in ggplot2 kunt wijzigen, met verschillende voorbeelden.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/nl\/ggplot-lijntype\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-17T22:37:41+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/type-de-ligne1.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\u00a0Minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/nl\/ggplot-lijntype\/\",\"url\":\"https:\/\/statorials.org\/nl\/ggplot-lijntype\/\",\"name\":\"Hoe het lijntype in ggplot2 te veranderen \u2013 Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/nl\/#website\"},\"datePublished\":\"2023-07-17T22:37:41+00:00\",\"dateModified\":\"2023-07-17T22:37:41+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219\"},\"description\":\"In deze tutorial wordt uitgelegd hoe u het lijntype in ggplot2 kunt wijzigen, met verschillende voorbeelden.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/nl\/ggplot-lijntype\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/nl\/ggplot-lijntype\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/nl\/ggplot-lijntype\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Thuis\",\"item\":\"https:\/\/statorials.org\/nl\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Hoe het lijntype in ggplot2 te veranderen\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statorials.org\/nl\/#website\",\"url\":\"https:\/\/statorials.org\/nl\/\",\"name\":\"Statorials\",\"description\":\"Uw gids voor statistische competentie\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statorials.org\/nl\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"de\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219\",\"name\":\"Dr.benjamin anderson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"contentUrl\":\"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"caption\":\"Dr.benjamin anderson\"},\"description\":\"Ik ben Benjamin, een gepensioneerde hoogleraar statistiek die nu een toegewijde Statorials-lesgever is. Ik heb uitgebreide ervaring en expertise op het gebied van statistiek en ik ben vastbesloten om mijn kennis te delen met studenten via Statorials. Lees verder\",\"sameAs\":[\"http:\/\/statorials.org\/nl\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Hoe het lijntype in ggplot2 te veranderen \u2013 Statorials","description":"In deze tutorial wordt uitgelegd hoe u het lijntype in ggplot2 kunt wijzigen, met verschillende voorbeelden.","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\/nl\/ggplot-lijntype\/","og_locale":"de_DE","og_type":"article","og_title":"Hoe het lijntype in ggplot2 te veranderen \u2013 Statorials","og_description":"In deze tutorial wordt uitgelegd hoe u het lijntype in ggplot2 kunt wijzigen, met verschillende voorbeelden.","og_url":"https:\/\/statorials.org\/nl\/ggplot-lijntype\/","og_site_name":"Statorials","article_published_time":"2023-07-17T22:37:41+00:00","og_image":[{"url":"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/type-de-ligne1.jpg"}],"author":"Dr.benjamin anderson","twitter_card":"summary_large_image","twitter_misc":{"Verfasst von":"Dr.benjamin anderson","Gesch\u00e4tzte Lesezeit":"2\u00a0Minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/nl\/ggplot-lijntype\/","url":"https:\/\/statorials.org\/nl\/ggplot-lijntype\/","name":"Hoe het lijntype in ggplot2 te veranderen \u2013 Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/nl\/#website"},"datePublished":"2023-07-17T22:37:41+00:00","dateModified":"2023-07-17T22:37:41+00:00","author":{"@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219"},"description":"In deze tutorial wordt uitgelegd hoe u het lijntype in ggplot2 kunt wijzigen, met verschillende voorbeelden.","breadcrumb":{"@id":"https:\/\/statorials.org\/nl\/ggplot-lijntype\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/nl\/ggplot-lijntype\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/nl\/ggplot-lijntype\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Thuis","item":"https:\/\/statorials.org\/nl\/"},{"@type":"ListItem","position":2,"name":"Hoe het lijntype in ggplot2 te veranderen"}]},{"@type":"WebSite","@id":"https:\/\/statorials.org\/nl\/#website","url":"https:\/\/statorials.org\/nl\/","name":"Statorials","description":"Uw gids voor statistische competentie","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statorials.org\/nl\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"de"},{"@type":"Person","@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219","name":"Dr.benjamin anderson","image":{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/image\/","url":"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","contentUrl":"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","caption":"Dr.benjamin anderson"},"description":"Ik ben Benjamin, een gepensioneerde hoogleraar statistiek die nu een toegewijde Statorials-lesgever is. Ik heb uitgebreide ervaring en expertise op het gebied van statistiek en ik ben vastbesloten om mijn kennis te delen met studenten via Statorials. Lees verder","sameAs":["http:\/\/statorials.org\/nl"]}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts\/3355","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/comments?post=3355"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts\/3355\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/media?parent=3355"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/categories?post=3355"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/tags?post=3355"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}