{"id":2000,"date":"2018-02-21T09:46:58","date_gmt":"2018-02-21T04:16:58","guid":{"rendered":"http:\/\/stepbystepschools.net\/?p=2000"},"modified":"2018-02-21T09:46:58","modified_gmt":"2018-02-21T04:16:58","slug":"data-science-training-in-mumbai-displaying-a-simple-graph-using-r","status":"publish","type":"post","link":"https:\/\/www.stepbystepschools.net\/?p=2000","title":{"rendered":"Data Science Training in Mumbai :- Displaying a Simple Graph using R."},"content":{"rendered":"<p><a href=\"http:\/\/stepbystepschools.net\/wp-content\/uploads\/2018\/02\/1-4.jpg\" rel=\"attachment wp-att-2001\"><img loading=\"lazy\" src=\"http:\/\/stepbystepschools.net\/wp-content\/uploads\/2018\/02\/1-4.jpg\" alt=\"1\" width=\"602\" height=\"517\" class=\"aligncenter size-full wp-image-2001\" srcset=\"https:\/\/www.stepbystepschools.net\/wp-content\/uploads\/2018\/02\/1-4.jpg 602w, https:\/\/www.stepbystepschools.net\/wp-content\/uploads\/2018\/02\/1-4-300x258.jpg 300w\" sizes=\"(max-width: 602px) 100vw, 602px\" \/><\/a><\/p>\n<p>R programming contains a multitude of library that can be used to display a visual representation of our computed data.<\/p>\n<p>ggplot2 is a very famous graphs package and is viewed as the most powerful graphics device R has to offer. <\/p>\n<h3>Initial Environment Setup<\/h3>\n<p>But before we get into creating a program let\u2019s just first set up a proper environment for R programming.<\/p>\n<p>To install R programming tool go to the following link and download the software and install it.<\/p>\n<p>For Windows Users:<\/p>\n<p><a target=\"_blank\" href=\"https:\/\/ftp.iitm.ac.in\/cran\/\">https:\/\/ftp.iitm.ac.in\/cran\/<\/a><\/p>\n<p><a href=\"http:\/\/stepbystepschools.net\/wp-content\/uploads\/2018\/02\/2-4.jpg\" rel=\"attachment wp-att-2002\"><img loading=\"lazy\" src=\"http:\/\/stepbystepschools.net\/wp-content\/uploads\/2018\/02\/2-4.jpg\" alt=\"2\" width=\"602\" height=\"118\" class=\"aligncenter size-full wp-image-2002\" srcset=\"https:\/\/www.stepbystepschools.net\/wp-content\/uploads\/2018\/02\/2-4.jpg 602w, https:\/\/www.stepbystepschools.net\/wp-content\/uploads\/2018\/02\/2-4-300x59.jpg 300w\" sizes=\"(max-width: 602px) 100vw, 602px\" \/><\/a><\/p>\n<p>And Type and Run the following code RGui<\/p>\n<p><font size=\"5\"><span style=\"background-color: #D6D6AB\">install.packages<\/span><\/font><font size=\"5\"><span style=\"background-color: #D6D6AB\">(&#8220;ggplot2&#8221;)<\/span><\/font><\/p>\n<p><b>For Linux Users:<\/b><\/p>\n<p>If you are on Linux platform then you can use this fast and easy command used in Linux which can be used to install R. The yum command is used for installing like this:<\/p>\n<p>$ yum install R<\/p>\n<p>For Ubuntu Linux or other Debian-related OSs, a more direct method is:<\/p>\n<p>$ apt-get install r-base<\/p>\n<p>Now Let\u2019s Start using the RGui (64 -bit) which will be installed in the Installation folder which we had selected while installing the software.<\/p>\n<p>Let us now take the following example and execute in the RGui<\/p>\n<p><span style=\"background-color: #C0C0C0\">df <- data.frame (<br \/>\n  group = c(&#8220;Male&#8221;, &#8220;Female&#8221;, &#8220;Child&#8221;),<br \/>\n  value = c(25, 25, 50)<br \/>\n  )<br \/>\n<\/span><span style=\"background-color: #C0C0C0\">head(df)<br \/>\n<\/span>\n<\/p>\n<p><b>Output:<\/b><\/p>\n<p><span style=\"background-color: #00FF00\">group      value<\/span><\/p>\n<p><span style=\"background-color: #00FF00\">1 Male         25<\/span><\/p>\n<p><span style=\"background-color: #00FF00\">2 Female      25<\/span><\/p>\n<p><span style=\"background-color: #00FF00\">3 Child          50<\/span><\/p>\n<p>A DataFrame is a collection of multiple Series where Series is an immutable single dimensional array.<\/p>\n<p>group and value are two series inside the df dataframe.<\/p>\n<p>The above code declares this dataframe in the memory.<\/p>\n<p>Now to create a Bar plot we need to import ggplot2 library and write the following code<\/p>\n<p><span style=\"background-color: #C0C0C0\">library(ggplot2)<br \/>\n# Barplot<br \/>\n<\/span><span style=\"background-color: #C0C0C0\">bp<- ggplot(df, aes(x=\"\", y=value, fill=group))+<br \/>\n<\/span><span style=\"background-color: #C0C0C0\">geom_bar(width = 1, stat = &#8220;identity&#8221;)<br \/>\n<\/span><span style=\"background-color: #C0C0C0\">bp<\/span>\n<\/p>\n<p><b>X<\/b> co-ordinate in the above code will remain empty as this a flat graph with only <b>Y<\/b> co-ordinate receiving the input value<\/p>\n<p><b>Output:<\/b><\/p>\n<p><a href=\"http:\/\/stepbystepschools.net\/wp-content\/uploads\/2018\/02\/3-4.jpg\" rel=\"attachment wp-att-2003\"><img loading=\"lazy\" src=\"http:\/\/stepbystepschools.net\/wp-content\/uploads\/2018\/02\/3-4.jpg\" alt=\"3\" width=\"405\" height=\"412\" class=\"aligncenter size-full wp-image-2003\" srcset=\"https:\/\/www.stepbystepschools.net\/wp-content\/uploads\/2018\/02\/3-4.jpg 405w, https:\/\/www.stepbystepschools.net\/wp-content\/uploads\/2018\/02\/3-4-295x300.jpg 295w\" sizes=\"(max-width: 405px) 100vw, 405px\" \/><\/a><\/p>\n<p>Next let\u2019s look at a simple Pie chart<\/p>\n<p><span style=\"background-color: #C0C0C0\">pie <- bp + coord_polar(\"y\", start=0)<br \/>\npie<br \/>\n<\/span>\n<\/p>\n<p><b>Output:<\/b><\/p>\n<p><a href=\"http:\/\/stepbystepschools.net\/wp-content\/uploads\/2018\/02\/4-3.jpg\" rel=\"attachment wp-att-2004\"><img loading=\"lazy\" src=\"http:\/\/stepbystepschools.net\/wp-content\/uploads\/2018\/02\/4-3.jpg\" alt=\"4\" width=\"359\" height=\"316\" class=\"aligncenter size-full wp-image-2004\" srcset=\"https:\/\/www.stepbystepschools.net\/wp-content\/uploads\/2018\/02\/4-3.jpg 359w, https:\/\/www.stepbystepschools.net\/wp-content\/uploads\/2018\/02\/4-3-300x264.jpg 300w\" sizes=\"(max-width: 359px) 100vw, 359px\" \/><\/a><\/p>\n<p><a target=\"_blank\" href=\"http:\/\/stepbystepschools.net\/?page_id=1842\">Syllabus of Data Science training in Mumbai<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>R programming contains a multitude of library that can be used to display a visual representation of our computed data. ggplot2 is a very famous graphs package and is viewed as the most powerful graphics device R has to offer. &hellip; <a href=\"https:\/\/www.stepbystepschools.net\/?p=2000\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":40,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[1],"tags":[198,199,202],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v18.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Data Science Training in Mumbai :- Displaying a Simple Graph using R. - Learn MVC, Angular, Architecture, MSBI, Data Science in Mumbai<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.stepbystepschools.net\/?p=2000\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Data Science Training in Mumbai :- Displaying a Simple Graph using R. - Learn MVC, Angular, Architecture, MSBI, Data Science in Mumbai\" \/>\n<meta property=\"og:description\" content=\"R programming contains a multitude of library that can be used to display a visual representation of our computed data. ggplot2 is a very famous graphs package and is viewed as the most powerful graphics device R has to offer. &hellip; Continue reading &rarr;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.stepbystepschools.net\/?p=2000\" \/>\n<meta property=\"og:site_name\" content=\"Learn MVC, Angular, Architecture, MSBI, Data Science in Mumbai\" \/>\n<meta property=\"article:published_time\" content=\"2018-02-21T04:16:58+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/stepbystepschools.net\/wp-content\/uploads\/2018\/02\/1-4.jpg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"StepByStepSchoolsSupport\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\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\":\"WebSite\",\"@id\":\"https:\/\/www.stepbystepschools.net\/#website\",\"url\":\"https:\/\/www.stepbystepschools.net\/\",\"name\":\"Learn MVC, Angular, Architecture, MSBI, Data Science in Mumbai\",\"description\":\"MVC 5\/Core, AngularJS 1.x, 2.0, 4.0, Design Pattern, Architecture, SSIS, SSAS, SSRS, Data Science, Big data, Hadoop classroom training\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.stepbystepschools.net\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.stepbystepschools.net\/?p=2000#primaryimage\",\"url\":\"http:\/\/stepbystepschools.net\/wp-content\/uploads\/2018\/02\/1-4.jpg\",\"contentUrl\":\"http:\/\/stepbystepschools.net\/wp-content\/uploads\/2018\/02\/1-4.jpg\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.stepbystepschools.net\/?p=2000#webpage\",\"url\":\"https:\/\/www.stepbystepschools.net\/?p=2000\",\"name\":\"Data Science Training in Mumbai :- Displaying a Simple Graph using R. - Learn MVC, Angular, Architecture, MSBI, Data Science in Mumbai\",\"isPartOf\":{\"@id\":\"https:\/\/www.stepbystepschools.net\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.stepbystepschools.net\/?p=2000#primaryimage\"},\"datePublished\":\"2018-02-21T04:16:58+00:00\",\"dateModified\":\"2018-02-21T04:16:58+00:00\",\"author\":{\"@id\":\"https:\/\/www.stepbystepschools.net\/#\/schema\/person\/7131e4ee1c5673879e6029d14ec2f655\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.stepbystepschools.net\/?p=2000#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.stepbystepschools.net\/?p=2000\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.stepbystepschools.net\/?p=2000#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.stepbystepschools.net\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Data Science Training in Mumbai :- Displaying a Simple Graph using R.\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.stepbystepschools.net\/#\/schema\/person\/7131e4ee1c5673879e6029d14ec2f655\",\"name\":\"StepByStepSchoolsSupport\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.stepbystepschools.net\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cecaf2a0ee369391127b0159c266979d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cecaf2a0ee369391127b0159c266979d?s=96&d=mm&r=g\",\"caption\":\"StepByStepSchoolsSupport\"},\"url\":\"https:\/\/www.stepbystepschools.net\/?author=40\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Data Science Training in Mumbai :- Displaying a Simple Graph using R. - Learn MVC, Angular, Architecture, MSBI, Data Science in Mumbai","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:\/\/www.stepbystepschools.net\/?p=2000","og_locale":"en_US","og_type":"article","og_title":"Data Science Training in Mumbai :- Displaying a Simple Graph using R. - Learn MVC, Angular, Architecture, MSBI, Data Science in Mumbai","og_description":"R programming contains a multitude of library that can be used to display a visual representation of our computed data. ggplot2 is a very famous graphs package and is viewed as the most powerful graphics device R has to offer. &hellip; Continue reading &rarr;","og_url":"https:\/\/www.stepbystepschools.net\/?p=2000","og_site_name":"Learn MVC, Angular, Architecture, MSBI, Data Science in Mumbai","article_published_time":"2018-02-21T04:16:58+00:00","og_image":[{"url":"http:\/\/stepbystepschools.net\/wp-content\/uploads\/2018\/02\/1-4.jpg"}],"twitter_card":"summary_large_image","twitter_misc":{"Written by":"StepByStepSchoolsSupport","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/www.stepbystepschools.net\/#website","url":"https:\/\/www.stepbystepschools.net\/","name":"Learn MVC, Angular, Architecture, MSBI, Data Science in Mumbai","description":"MVC 5\/Core, AngularJS 1.x, 2.0, 4.0, Design Pattern, Architecture, SSIS, SSAS, SSRS, Data Science, Big data, Hadoop classroom training","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.stepbystepschools.net\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.stepbystepschools.net\/?p=2000#primaryimage","url":"http:\/\/stepbystepschools.net\/wp-content\/uploads\/2018\/02\/1-4.jpg","contentUrl":"http:\/\/stepbystepschools.net\/wp-content\/uploads\/2018\/02\/1-4.jpg"},{"@type":"WebPage","@id":"https:\/\/www.stepbystepschools.net\/?p=2000#webpage","url":"https:\/\/www.stepbystepschools.net\/?p=2000","name":"Data Science Training in Mumbai :- Displaying a Simple Graph using R. - Learn MVC, Angular, Architecture, MSBI, Data Science in Mumbai","isPartOf":{"@id":"https:\/\/www.stepbystepschools.net\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.stepbystepschools.net\/?p=2000#primaryimage"},"datePublished":"2018-02-21T04:16:58+00:00","dateModified":"2018-02-21T04:16:58+00:00","author":{"@id":"https:\/\/www.stepbystepschools.net\/#\/schema\/person\/7131e4ee1c5673879e6029d14ec2f655"},"breadcrumb":{"@id":"https:\/\/www.stepbystepschools.net\/?p=2000#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.stepbystepschools.net\/?p=2000"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.stepbystepschools.net\/?p=2000#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.stepbystepschools.net\/"},{"@type":"ListItem","position":2,"name":"Data Science Training in Mumbai :- Displaying a Simple Graph using R."}]},{"@type":"Person","@id":"https:\/\/www.stepbystepschools.net\/#\/schema\/person\/7131e4ee1c5673879e6029d14ec2f655","name":"StepByStepSchoolsSupport","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.stepbystepschools.net\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/cecaf2a0ee369391127b0159c266979d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cecaf2a0ee369391127b0159c266979d?s=96&d=mm&r=g","caption":"StepByStepSchoolsSupport"},"url":"https:\/\/www.stepbystepschools.net\/?author=40"}]}},"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"_links":{"self":[{"href":"https:\/\/www.stepbystepschools.net\/index.php?rest_route=\/wp\/v2\/posts\/2000"}],"collection":[{"href":"https:\/\/www.stepbystepschools.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.stepbystepschools.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.stepbystepschools.net\/index.php?rest_route=\/wp\/v2\/users\/40"}],"replies":[{"embeddable":true,"href":"https:\/\/www.stepbystepschools.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2000"}],"version-history":[{"count":2,"href":"https:\/\/www.stepbystepschools.net\/index.php?rest_route=\/wp\/v2\/posts\/2000\/revisions"}],"predecessor-version":[{"id":2006,"href":"https:\/\/www.stepbystepschools.net\/index.php?rest_route=\/wp\/v2\/posts\/2000\/revisions\/2006"}],"wp:attachment":[{"href":"https:\/\/www.stepbystepschools.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2000"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.stepbystepschools.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2000"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.stepbystepschools.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2000"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}