{"id":962,"date":"2023-07-28T04:21:01","date_gmt":"2023-07-28T04:21:01","guid":{"rendered":"https:\/\/statorials.org\/nl\/stel-ggplot2-aslimieten-in\/"},"modified":"2023-07-28T04:21:01","modified_gmt":"2023-07-28T04:21:01","slug":"stel-ggplot2-aslimieten-in","status":"publish","type":"post","link":"https:\/\/statorials.org\/nl\/stel-ggplot2-aslimieten-in\/","title":{"rendered":"Hoe aslimieten in ggplot2 in te stellen"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">Vaak wilt u misschien aslimieten instellen op een plot met behulp van <a href=\"https:\/\/ggplot2.tidyverse.org\/index.html\" target=\"_blank\" rel=\"noopener noreferrer\">ggplot2<\/a> . U kunt dit eenvoudig doen met behulp van de volgende functies:<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\"><strong>xlim()<\/strong> : Specificeert de onder- en bovengrens van de x-as.<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>ylim():<\/strong> specificeert de onder- en bovengrens van de y-as.<\/span><\/li>\n<\/ul>\n<p> <span style=\"color: #000000;\">Houd er rekening mee dat beide methoden gegevens buiten de grenzen verwijderen, wat soms onbedoelde gevolgen kan hebben. Om de asgrenzen te wijzigen zonder datawaarnemingen te verwijderen, kunt u coord_cartesian():<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\"><strong>coord_cartesian():<\/strong> Specificeert de grenzen van de x-as en y-as zonder waarnemingen te verwijderen.<\/span><\/li>\n<\/ul>\n<p> <span style=\"color: #000000;\">In deze tutorial worden verschillende manieren uitgelegd om deze functies te gebruiken met behulp van de volgende spreidingsdiagram gemaakt met de in <em>mtcars<\/em> ingebedde R-dataset:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#load ggplot2<\/span>\nlibrary(ggplot2)\n\n<span style=\"color: #008080;\">#create scatterplot\n<\/span>ggplot(mtcars, aes(mpg, wt)) +\n  geom_point()\n<\/strong><\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-10095 \" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/axislimitsggplot1.png\" alt=\"\" width=\"610\" height=\"367\" srcset=\"\" sizes=\"auto, \"><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Voorbeeld 1: X-aslimieten instellen met xlim()<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">De volgende code laat zien hoe u de limieten van de X-as van het spreidingsdiagram kunt instellen met behulp van de functie <strong>xlim()<\/strong> :<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#create scatterplot with x-axis ranging from 15 to 30\n<\/span>ggplot(mtcars, aes(mpg, wt)) +\n  geom_point() +\n  xlim <span style=\"color: #3366ff;\">(15, 30)\n\n<span style=\"color: #808080;\"><em>Warning message:\n\u201cRemoved 9 rows containing missing values (geom_point).\u201d\n<\/em><\/span><\/span><\/strong><\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-10096 \" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/axislimitsggplot2.png\" alt=\"Grenzen van de X-as instellen in ggplot2\" width=\"614\" height=\"369\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\">Je kunt <strong>NA<\/strong> ook gebruiken om alleen de bovengrens van de x-as in te stellen en ggplot2 automatisch de ondergrens te laten kiezen:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#create scatterplot with x-axis upper limit at 30\n<\/span>ggplot(mtcars, aes(mpg, wt)) +\n  geom_point() +\n  xlim <span style=\"color: #3366ff;\">( <span style=\"color: #993300;\">NA<\/span> , 30)\n\n<span style=\"color: #808080;\"><em>Warning message:\n\u201cRemoved 4 rows containing missing values (geom_point).\u201d<\/em><\/span><\/span><\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-10097 \" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/axislimitsggplot3.png\" alt=\"Hoe aslimieten in ggplot2 in te stellen\" width=\"613\" height=\"366\" srcset=\"\" sizes=\"auto, \"><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Voorbeeld 2: Y-aslimieten instellen met ylim()<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">De volgende code laat zien hoe u de grenzen van de y-as van het spreidingsdiagram kunt instellen met behulp van de functie <strong>ylim()<\/strong> :<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#create scatterplot with y-axis ranging from 2 to 4\n<\/span>ggplot(mtcars, aes(mpg, wt)) +\n  geom_point() +\n  ylim <span style=\"color: #3366ff;\">(2, 4)\n\n<span style=\"color: #808080;\"><em>Warning message:\n\u201cRemoved 8 rows containing missing values (geom_point).\u201d<\/em><\/span><\/span><\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-10098 \" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/axislimitsggplot4.png\" alt=\"Stel Y-aslimieten in ggplot2 in\" width=\"632\" height=\"376\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\">Je kunt <strong>NA<\/strong> ook gebruiken om alleen de ondergrens van de y-as in te stellen en ggplot2 automatisch de bovengrens te laten kiezen:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#create scatterplot with y-axis lower limit at 2\n<\/span>ggplot(mtcars, aes(mpg, wt)) +\n  geom_point() +\n  xlim <span style=\"color: #3366ff;\">(2, <span style=\"color: #993300;\">NA<\/span> )\n\n<span style=\"color: #808080;\"><em>Warning message:\n\u201cRemoved 4 rows containing missing values (geom_point).\u201d<\/em><\/span><\/span><\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-10099 \" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/axislimitsggplot5.png\" alt=\"\" width=\"610\" height=\"370\" srcset=\"\" sizes=\"auto, \"><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Voorbeeld 3: Aslimieten instellen met behulp van cordin_cartesian()<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">De volgende code laat zien hoe u de grenzen van de y-as van het spreidingsdiagram kunt instellen met behulp van de functie <strong>coord_cartesian()<\/strong> :<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#create scatterplot with y-axis ranging from 2 to 4\n<\/span>ggplot(mtcars, aes(mpg, wt)) +\n  geom_point() +\n  coord_cartesian(xlim =c <span style=\"color: #3366ff;\">(15, 25)<\/span> , ylim = c <span style=\"color: #3366ff;\">(3, 4)<\/span> )<span style=\"color: #3366ff;\">\n<\/span><\/strong><\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-10100 \" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/axislimitsggplot6.png\" alt=\"Stel aslimieten in ggplot2 in met behulp van de functie coord_cartesian().\" width=\"614\" height=\"372\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\"><em>Je kunt hier meer ggplot2-tutorials vinden.<\/em><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Vaak wilt u misschien aslimieten instellen op een plot met behulp van ggplot2 . U kunt dit eenvoudig doen met behulp van de volgende functies: xlim() : Specificeert de onder- en bovengrens van de x-as. ylim(): specificeert de onder- en bovengrens van de y-as. Houd er rekening mee dat beide methoden gegevens buiten de grenzen [&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-962","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 aslimieten in te stellen in ggplot2 \u2013 Statorials<\/title>\n<meta name=\"description\" content=\"Een eenvoudige uitleg over het instellen van aslimieten op een plot in ggplot2, inclusief 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\/stel-ggplot2-aslimieten-in\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Hoe aslimieten in te stellen in ggplot2 \u2013 Statorials\" \/>\n<meta property=\"og:description\" content=\"Een eenvoudige uitleg over het instellen van aslimieten op een plot in ggplot2, inclusief verschillende voorbeelden.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/nl\/stel-ggplot2-aslimieten-in\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-28T04:21:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/axislimitsggplot1.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\u00a0Minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/nl\/stel-ggplot2-aslimieten-in\/\",\"url\":\"https:\/\/statorials.org\/nl\/stel-ggplot2-aslimieten-in\/\",\"name\":\"Hoe aslimieten in te stellen in ggplot2 \u2013 Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/nl\/#website\"},\"datePublished\":\"2023-07-28T04:21:01+00:00\",\"dateModified\":\"2023-07-28T04:21:01+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219\"},\"description\":\"Een eenvoudige uitleg over het instellen van aslimieten op een plot in ggplot2, inclusief verschillende voorbeelden.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/nl\/stel-ggplot2-aslimieten-in\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/nl\/stel-ggplot2-aslimieten-in\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/nl\/stel-ggplot2-aslimieten-in\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Thuis\",\"item\":\"https:\/\/statorials.org\/nl\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Hoe aslimieten in ggplot2 in te stellen\"}]},{\"@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 aslimieten in te stellen in ggplot2 \u2013 Statorials","description":"Een eenvoudige uitleg over het instellen van aslimieten op een plot in ggplot2, inclusief 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\/stel-ggplot2-aslimieten-in\/","og_locale":"de_DE","og_type":"article","og_title":"Hoe aslimieten in te stellen in ggplot2 \u2013 Statorials","og_description":"Een eenvoudige uitleg over het instellen van aslimieten op een plot in ggplot2, inclusief verschillende voorbeelden.","og_url":"https:\/\/statorials.org\/nl\/stel-ggplot2-aslimieten-in\/","og_site_name":"Statorials","article_published_time":"2023-07-28T04:21:01+00:00","og_image":[{"url":"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/axislimitsggplot1.png"}],"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\/stel-ggplot2-aslimieten-in\/","url":"https:\/\/statorials.org\/nl\/stel-ggplot2-aslimieten-in\/","name":"Hoe aslimieten in te stellen in ggplot2 \u2013 Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/nl\/#website"},"datePublished":"2023-07-28T04:21:01+00:00","dateModified":"2023-07-28T04:21:01+00:00","author":{"@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219"},"description":"Een eenvoudige uitleg over het instellen van aslimieten op een plot in ggplot2, inclusief verschillende voorbeelden.","breadcrumb":{"@id":"https:\/\/statorials.org\/nl\/stel-ggplot2-aslimieten-in\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/nl\/stel-ggplot2-aslimieten-in\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/nl\/stel-ggplot2-aslimieten-in\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Thuis","item":"https:\/\/statorials.org\/nl\/"},{"@type":"ListItem","position":2,"name":"Hoe aslimieten in ggplot2 in te stellen"}]},{"@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\/962","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=962"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts\/962\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/media?parent=962"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/categories?post=962"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/tags?post=962"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}