{"id":4276,"date":"2023-07-12T08:52:34","date_gmt":"2023-07-12T08:52:34","guid":{"rendered":"https:\/\/statorials.org\/nl\/r-tekencurve\/"},"modified":"2023-07-12T08:52:34","modified_gmt":"2023-07-12T08:52:34","slug":"r-tekencurve","status":"publish","type":"post","link":"https:\/\/statorials.org\/nl\/r-tekencurve\/","title":{"rendered":"Hoe een functiecurve in r te tekenen (met voorbeeld)"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">U kunt de volgende methoden gebruiken om een functiecurve in R te tekenen:<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>Methode 1: Gebruik Base R<\/strong><\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong>curve(x^3, from=1, to=50, xlab=' <span style=\"color: #ff0000;\">x<\/span> ', ylab=' <span style=\"color: #ff0000;\">y<\/span> ')<\/strong><\/pre>\n<p> <span style=\"color: #000000;\"><strong>Methode 2: gebruik ggplot2<\/strong><\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008000;\">library<\/span> (ggplot2)\n\ndf &lt;- data. <span style=\"color: #3366ff;\">frame<\/span> (x=c(1, 100))\neq = function(x){x^3}\n\n<span style=\"color: #008080;\">#plot curve in ggplot2\n<\/span>ggplot(data=df, aes(x=x)) + \n  stat_function(fun=eq)<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Beide methoden leveren een grafiek op die de curve van de functie <strong>y = x <sup>3<\/sup><\/strong> weergeeft.<\/span><\/p>\n<p> <span style=\"color: #000000;\">De volgende voorbeelden laten zien hoe u elke methode in de praktijk kunt gebruiken.<\/span><\/p>\n<h2> <span style=\"color: #000000;\"><strong>Voorbeeld 1: Teken de functiecurve met behulp van de grondtal R<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">De volgende code laat zien hoe u de curve van de functie <strong>y = x <sup>3<\/sup><\/strong> kunt plotten met behulp van de functie <strong>Curve()<\/strong> van de basis R:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#plot curve using x-axis range of 1 to 50\n<\/span>curve(x^3, from=1, to=50, xlab=' <span style=\"color: #ff0000;\">x<\/span> ', ylab=' <span style=\"color: #ff0000;\">y<\/span> ')\n<\/strong><\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-33712\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/cur1.jpg\" alt=\"teken de functiecurve in basis R\" width=\"492\" height=\"450\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\">Merk op dat u de volgende argumenten kunt gebruiken om het uiterlijk van de curve te wijzigen:<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\"><strong>lwd<\/strong> : lijndikte<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>kraag<\/strong> : lijnkleur<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>type<\/strong> : Lijnstijl<\/span><\/li>\n<\/ul>\n<p> <span style=\"color: #000000;\">De volgende code laat zien hoe u deze argumenten in de praktijk kunt gebruiken:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#plot curve using x-axis range of 1 to 50\n<\/span>curve(x^3, from=1, to=50, xlab=' <span style=\"color: #ff0000;\">x<\/span> ', ylab=' <span style=\"color: #ff0000;\">y<\/span> ', lwd= <span style=\"color: #008000;\">3<\/span> , col=' <span style=\"color: #ff0000;\">red<\/span> ', lty=' <span style=\"color: #ff0000;\">dashed<\/span> '))<\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-33713 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/cur2.jpg\" alt=\"\" width=\"484\" height=\"446\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\">Voel je vrij om met de waarden van deze argumenten te spelen om precies de gewenste curve te cre\u00ebren.<\/span><\/p>\n<h2> <span style=\"color: #000000;\"><strong>Voorbeeld 2: Teken de functiecurve met ggplot2<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">De volgende code laat zien hoe je de functie <strong>y = x <sup>3<\/sup><\/strong> plot met behulp van de ggplot2 <strong>stat_function()<\/strong> functie:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\"><span style=\"color: #000000;\"><span style=\"color: #008000;\">library<\/span> (ggplot2)<\/span>\n\n#define data frame\n<\/span>df &lt;- data. <span style=\"color: #3366ff;\">frame<\/span> (x=c(1, 100))\n\n<span style=\"color: #008080;\">#define function \n<\/span>eq = function(x){x^3}\n\n<span style=\"color: #008080;\">#plot curve in ggplot2\n<\/span>ggplot(data=df, aes(x=x)) + \n  stat_function(fun=eq)\n<\/strong><\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-33714\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/cur3.jpg\" alt=\"plot de functiecurve in ggplot2\" width=\"491\" height=\"490\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\">U kunt ook de functies <strong>lwd<\/strong> , <strong>col<\/strong> en <strong>lty<\/strong> in de functie <strong>stat_function()<\/strong> gebruiken om het uiterlijk van de curve te wijzigen:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\"><span style=\"color: #000000;\"><span style=\"color: #008000;\">library<\/span> (ggplot2)<\/span>\n\n#define data frame\n<\/span>df &lt;- data. <span style=\"color: #3366ff;\">frame<\/span> (x=c(1, 100))\n\n<span style=\"color: #008080;\">#define function \n<\/span>eq = function(x){x^3}\n\n<span style=\"color: #008080;\">#plot curve in ggplot2 with custom appearance\n<\/span>ggplot(data=df, aes(x=x)) + \n  stat_function(fun=eq, lwd= <span style=\"color: #008000;\">2<\/span> , col=' <span style=\"color: #ff0000;\">red<\/span> ', lty=' <span style=\"color: #ff0000;\">dashed<\/span> ')<\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-33715 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/cur4.jpg\" alt=\"\" width=\"476\" height=\"470\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\"><strong>Opmerking<\/strong> : u kunt<a href=\"https:\/\/ggplot2.tidyverse.org\/reference\/geom_function.html\" target=\"_blank\" rel=\"noopener\">hier<\/a> de volledige documentatie voor de ggplot2 <strong>stat_function()<\/strong> functie vinden.<\/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 taken in R kunt uitvoeren:<\/span><\/p>\n<p> <a href=\"https:\/\/statorials.org\/nl\/r-legendapositie\/\" target=\"_blank\" rel=\"noopener\">Hoe u de positie van de legenda in R-plots kunt wijzigen<\/a><br \/> <a href=\"https:\/\/statorials.org\/nl\/r-plot-bty\/\" target=\"_blank\" rel=\"noopener\">Hoe bty te gebruiken om de diagramvakstijlen in R te wijzigen<\/a><br \/> <a href=\"https:\/\/statorials.org\/nl\/r-pakket-cex\/\" target=\"_blank\" rel=\"noopener\">Hoe cex te gebruiken om de grootte van plotelementen in R te wijzigen<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>U kunt de volgende methoden gebruiken om een functiecurve in R te tekenen: Methode 1: Gebruik Base R curve(x^3, from=1, to=50, xlab=&#8216; x &#8218;, ylab=&#8216; y &#8218;) Methode 2: gebruik ggplot2 library (ggplot2) df &lt;- data. frame (x=c(1, 100)) eq = function(x){x^3} #plot curve in ggplot2 ggplot(data=df, aes(x=x)) + stat_function(fun=eq) Beide methoden leveren een grafiek [&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-4276","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 een functiecurve in R te tekenen (met voorbeeld) - Statorialen<\/title>\n<meta name=\"description\" content=\"In deze tutorial wordt uitgelegd hoe je een functiecurve in R tekent, 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\/r-tekencurve\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Hoe een functiecurve in R te tekenen (met voorbeeld) - Statorialen\" \/>\n<meta property=\"og:description\" content=\"In deze tutorial wordt uitgelegd hoe je een functiecurve in R tekent, met verschillende voorbeelden.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/nl\/r-tekencurve\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-12T08:52:34+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/cur1.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\/r-tekencurve\/\",\"url\":\"https:\/\/statorials.org\/nl\/r-tekencurve\/\",\"name\":\"Hoe een functiecurve in R te tekenen (met voorbeeld) - Statorialen\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/nl\/#website\"},\"datePublished\":\"2023-07-12T08:52:34+00:00\",\"dateModified\":\"2023-07-12T08:52:34+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219\"},\"description\":\"In deze tutorial wordt uitgelegd hoe je een functiecurve in R tekent, met verschillende voorbeelden.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/nl\/r-tekencurve\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/nl\/r-tekencurve\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/nl\/r-tekencurve\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Thuis\",\"item\":\"https:\/\/statorials.org\/nl\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Hoe een functiecurve in r te tekenen (met voorbeeld)\"}]},{\"@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 een functiecurve in R te tekenen (met voorbeeld) - Statorialen","description":"In deze tutorial wordt uitgelegd hoe je een functiecurve in R tekent, 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\/r-tekencurve\/","og_locale":"de_DE","og_type":"article","og_title":"Hoe een functiecurve in R te tekenen (met voorbeeld) - Statorialen","og_description":"In deze tutorial wordt uitgelegd hoe je een functiecurve in R tekent, met verschillende voorbeelden.","og_url":"https:\/\/statorials.org\/nl\/r-tekencurve\/","og_site_name":"Statorials","article_published_time":"2023-07-12T08:52:34+00:00","og_image":[{"url":"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/cur1.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\/r-tekencurve\/","url":"https:\/\/statorials.org\/nl\/r-tekencurve\/","name":"Hoe een functiecurve in R te tekenen (met voorbeeld) - Statorialen","isPartOf":{"@id":"https:\/\/statorials.org\/nl\/#website"},"datePublished":"2023-07-12T08:52:34+00:00","dateModified":"2023-07-12T08:52:34+00:00","author":{"@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219"},"description":"In deze tutorial wordt uitgelegd hoe je een functiecurve in R tekent, met verschillende voorbeelden.","breadcrumb":{"@id":"https:\/\/statorials.org\/nl\/r-tekencurve\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/nl\/r-tekencurve\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/nl\/r-tekencurve\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Thuis","item":"https:\/\/statorials.org\/nl\/"},{"@type":"ListItem","position":2,"name":"Hoe een functiecurve in r te tekenen (met voorbeeld)"}]},{"@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\/4276","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=4276"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts\/4276\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/media?parent=4276"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/categories?post=4276"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/tags?post=4276"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}