{"id":2982,"date":"2023-07-19T19:16:07","date_gmt":"2023-07-19T19:16:07","guid":{"rendered":"https:\/\/statorials.org\/nl\/r-ongeldige-grafische-status\/"},"modified":"2023-07-19T19:16:07","modified_gmt":"2023-07-19T19:16:07","slug":"r-ongeldige-grafische-status","status":"publish","type":"post","link":"https:\/\/statorials.org\/nl\/r-ongeldige-grafische-status\/","title":{"rendered":"Oplossing in r: ongeldige grafische status (3 oplossingen)"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">Een fout die je tegen kunt komen in R is:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong>Error in .Call.graphics(C_palette2, .Call(C_palette2, NULL)): \n  invalid graphics state\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Deze fout kan om drie redenen optreden:<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>1.<\/strong> U maakt tijdens dezelfde sessie plots in base R en ggplot2.<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>2.<\/strong> Uw versie van ggplot2 is niet compatibel met uw versie van R.<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>3.<\/strong> Uw grafische instellingen voorkomen dat er nieuwe plots worden gemaakt.<\/span><\/p>\n<p> <span style=\"color: #000000;\">In deze zelfstudie worden drie methoden besproken die u kunt gebruiken om deze fout op te lossen.<\/span><\/p>\n<h3> <strong>Hoe de fout te reproduceren<\/strong><\/h3>\n<p> <span style=\"color: #000000;\">Stel dat we proberen een puntenwolk te cre\u00ebren met behulp van de <a href=\"https:\/\/statorials.org\/nl\/mtcars-r-gegevensset\/\" target=\"_blank\" rel=\"noopener\">mtcars-<\/a> dataset die in R is ingebouwd:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #008080;\"><span style=\"color: #000000;\"><span style=\"color: #008000;\">library<\/span> (ggplot2)<\/span>\n\n#attempt to create scatterplot \n<span style=\"color: #000000;\">ggplot(mtcars, <span style=\"color: #3366ff;\">aes<\/span> (x=mpg, y=hp)) +\n  geom_point()\n<\/span><\/span><\/strong><\/span><\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-25794 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/invalide1.jpg\" alt=\"\" width=\"675\" height=\"455\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\">We ontvangen de foutmelding <strong>Ongeldige grafische status<\/strong> , maar de reden is onduidelijk.<\/span><\/p>\n<p> <span style=\"color: #000000;\">De volgende drie methoden laten zien hoe u deze fout kunt oplossen.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Methode #1: Los de fout op met dev.off()<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">De eerste methode die u moet proberen (en de eenvoudigste methode) is om simpelweg <strong>dev.off()<\/strong> te gebruiken om het huidige traceerapparaat uit te schakelen.<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong>dev. <span style=\"color: #3366ff;\">off<\/span> ()<\/strong><\/span><\/pre>\n<p> <span style=\"color: #000000;\">U kunt vervolgens uw originele code opnieuw uitvoeren om de puntenwolk te maken.<\/span><\/p>\n<p> <span style=\"color: #000000;\">In veel gevallen kan dit de fout verhelpen, omdat hierdoor alle plotinstellingen worden verwijderd die voor eerdere plots zijn gebruikt en die mogelijk uw huidige plot verstoren.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Methode #2: Los de fout op door RStudio opnieuw te starten<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Als de vorige methode niet werkte, kunt u proberen uw RStudio-sessie opnieuw te starten.<\/span> <\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-25795 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/invalide2.jpg\" alt=\"\" width=\"638\" height=\"418\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\">In veel gevallen kan dit ook de fout herstellen, omdat alle eerdere plotinstellingen die uw huidige plot verstoorden, worden gewist.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Methode #3: Los de fout op door ggplot2 opnieuw te installeren<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Als de vorige twee methoden niet werkten, moet u mogelijk ggplot2 verwijderen en vervolgens opnieuw installeren.<\/span><\/p>\n<p> <span style=\"color: #000000;\">U kunt de volgende syntaxis gebruiken om uw huidige versie van ggplot2 te verwijderen:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #008080;\">#uninstall ggplot2<\/span>\nremove.remove. <span style=\"color: #3366ff;\">packages<\/span> (\" <span style=\"color: #008000;\">ggplot2<\/span> \")\n<\/strong><\/span><\/pre>\n<p> <span style=\"color: #000000;\">U kunt vervolgens de volgende syntaxis gebruiken om de nieuwste versie van ggplot2 te installeren:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #008080;\">#install ggplot2<\/span>\ninstall. <span style=\"color: #3366ff;\">packages<\/span> (\" <span style=\"color: #008000;\">ggplot2<\/span> \")<\/strong><\/span><\/pre>\n<p> <span style=\"color: #000000;\">Vervolgens kunt u de code opnieuw uitvoeren om de puntenwolk te maken:<\/span> <\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-25796 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/invalide3.jpg\" alt=\"\" width=\"386\" height=\"596\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\">In de meeste gevallen kunnen we nu de plot zonder fouten maken.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Aanvullende bronnen<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">In de volgende tutorials wordt uitgelegd hoe u andere veelvoorkomende problemen in R kunt oplossen:<\/span><\/p>\n<p> Oplossing in R: ongeldig factorniveau, NA gegenereerd<br \/> <a href=\"https:\/\/statorials.org\/nl\/r-plot-nieuw-is-nog-niet-genoemd\/\" target=\"_blank\" rel=\"noopener\">Hoe op te lossen in R: plot.new is nog niet aangeroepen<\/a><br \/> <a href=\"https:\/\/statorials.org\/nl\/r-niet-gedefinieerd-vanwege-singulariteiten\/\" target=\"_blank\" rel=\"noopener\">Hoe op te lossen in R: ongedefinieerd vanwege singulariteiten<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Een fout die je tegen kunt komen in R is: Error in .Call.graphics(C_palette2, .Call(C_palette2, NULL)): invalid graphics state Deze fout kan om drie redenen optreden: 1. U maakt tijdens dezelfde sessie plots in base R en ggplot2. 2. Uw versie van ggplot2 is niet compatibel met uw versie van R. 3. Uw grafische instellingen voorkomen [&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-2982","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 op te lossen in R: ongeldige grafische status (3 oplossingen) - Statorials<\/title>\n<meta name=\"description\" content=\"In deze tutorial wordt uitgelegd hoe u de ongeldige grafische statusfout in R kunt oplossen, 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-ongeldige-grafische-status\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Hoe op te lossen in R: ongeldige grafische status (3 oplossingen) - Statorials\" \/>\n<meta property=\"og:description\" content=\"In deze tutorial wordt uitgelegd hoe u de ongeldige grafische statusfout in R kunt oplossen, met verschillende voorbeelden.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/nl\/r-ongeldige-grafische-status\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-19T19:16:07+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/invalide1.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-ongeldige-grafische-status\/\",\"url\":\"https:\/\/statorials.org\/nl\/r-ongeldige-grafische-status\/\",\"name\":\"Hoe op te lossen in R: ongeldige grafische status (3 oplossingen) - Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/nl\/#website\"},\"datePublished\":\"2023-07-19T19:16:07+00:00\",\"dateModified\":\"2023-07-19T19:16:07+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219\"},\"description\":\"In deze tutorial wordt uitgelegd hoe u de ongeldige grafische statusfout in R kunt oplossen, met verschillende voorbeelden.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/nl\/r-ongeldige-grafische-status\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/nl\/r-ongeldige-grafische-status\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/nl\/r-ongeldige-grafische-status\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Thuis\",\"item\":\"https:\/\/statorials.org\/nl\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Oplossing in r: ongeldige grafische status (3 oplossingen)\"}]},{\"@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 op te lossen in R: ongeldige grafische status (3 oplossingen) - Statorials","description":"In deze tutorial wordt uitgelegd hoe u de ongeldige grafische statusfout in R kunt oplossen, 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-ongeldige-grafische-status\/","og_locale":"de_DE","og_type":"article","og_title":"Hoe op te lossen in R: ongeldige grafische status (3 oplossingen) - Statorials","og_description":"In deze tutorial wordt uitgelegd hoe u de ongeldige grafische statusfout in R kunt oplossen, met verschillende voorbeelden.","og_url":"https:\/\/statorials.org\/nl\/r-ongeldige-grafische-status\/","og_site_name":"Statorials","article_published_time":"2023-07-19T19:16:07+00:00","og_image":[{"url":"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/invalide1.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-ongeldige-grafische-status\/","url":"https:\/\/statorials.org\/nl\/r-ongeldige-grafische-status\/","name":"Hoe op te lossen in R: ongeldige grafische status (3 oplossingen) - Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/nl\/#website"},"datePublished":"2023-07-19T19:16:07+00:00","dateModified":"2023-07-19T19:16:07+00:00","author":{"@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219"},"description":"In deze tutorial wordt uitgelegd hoe u de ongeldige grafische statusfout in R kunt oplossen, met verschillende voorbeelden.","breadcrumb":{"@id":"https:\/\/statorials.org\/nl\/r-ongeldige-grafische-status\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/nl\/r-ongeldige-grafische-status\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/nl\/r-ongeldige-grafische-status\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Thuis","item":"https:\/\/statorials.org\/nl\/"},{"@type":"ListItem","position":2,"name":"Oplossing in r: ongeldige grafische status (3 oplossingen)"}]},{"@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\/2982","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=2982"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts\/2982\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/media?parent=2982"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/categories?post=2982"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/tags?post=2982"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}