[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-572749-105":3,"detail-sidebar-cat-1-en-105":80,"doc-detail-572749-en":126},{"code":4,"msg":5,"data":6},0,"ok",{"site_id":7,"language":8,"slug":9,"title":10,"keywords":11,"description":12,"schema_data":13,"social_meta":73,"head_meta":75,"extra_data":77,"updated_unix":79},105,"en","data-visualization-ggplot2-cheat-sheet-basics","Data Visualization - ggplot2 Cheat Sheet - Basics","","Cheat sheet summarizing core concepts of data visualization with ggplot2, based on the grammar of graphics: a data set, geoms (visual marks), and a coordinate system. Explains how aesthetic mappings connect variables to visual properties, and how to construct plots using ggplot() and qplot(), then extend them with layers via geom_*() and stat_*(). Includes guidance for saving plots, retrieving the last plot, and common geom patterns across one-variable, two-variable, bivariate distributions, continuous functions, error visualization, and maps.",{"@graph":14,"@context":72},[15,34,55],{"@type":16,"itemListElement":17},"BreadcrumbList",[18,23,27,31],{"item":19,"name":20,"@type":21,"position":22},"https://docshare.wps.com","Home","ListItem",1,{"item":24,"name":25,"@type":21,"position":26},"https://docshare.wps.com/template/","Template",2,{"item":28,"name":29,"@type":21,"position":30},"https://docshare.wps.com/template/general/","General",3,{"item":32,"name":10,"@type":21,"position":33},"https://docshare.wps.com/template/data-visualization-ggplot2-cheat-sheet-basics/572749/",4,{"url":32,"name":10,"@type":35,"image":36,"author":41,"headline":10,"publisher":44,"fileFormat":47,"inLanguage":8,"description":12,"dateModified":48,"datePublished":49,"encodingFormat":47,"isAccessibleForFree":50,"interactionStatistic":51},"DigitalDocument",{"url":37,"@type":38,"width":39,"height":40},"https://docshare.wps.com/thumbnails/data-visualization-ggplot2-cheat-sheet-basics/572749.png","ImageObject",442,249,{"name":42,"@type":43},"Đào","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-10-21","2026-10-13",true,{"@type":52,"interactionType":53,"userInteractionCount":30},"InteractionCounter",{"@type":54},"ViewAction",{"@type":56,"mainEntity":57},"FAQPage",[58,64,68],{"name":59,"@type":60,"acceptedAnswer":61},"What are the main components of a ggplot2 plot?","Question",{"text":62,"@type":63},"ggplot2 follows the grammar of graphics: a data set, geoms (visual marks representing data points), and a coordinate system.","Answer",{"name":65,"@type":60,"acceptedAnswer":66},"How do aesthetic mappings work in ggplot2?",{"text":67,"@type":63},"Aesthetic mappings connect variables from the data set to visual properties such as size, color, and x/y positions of a geom.",{"name":69,"@type":60,"acceptedAnswer":70},"How can a plot be extended in ggplot2?",{"text":71,"@type":63},"Start with ggplot() (or qplot()), then add layers using geom_*() or stat_*() functions, which provide geoms, mappings, and default statistics.","https://schema.org",{"og:url":32,"og:type":74,"og:title":10,"og:site_name":45,"og:description":12},"article",{"robots":76,"canonical":32},"index,follow",{"doc_id":78,"site_id":7},572749,1792453977,{"code":4,"msg":81,"data":82},"success",[83,88,93,98,103,108,113,118,123],{"id":84,"doc_module":22,"doc_module_name":25,"category_name":85,"show_sort_weight":86,"slug":87},11,"Presentations",90,"presentations",{"id":89,"doc_module":22,"doc_module_name":25,"category_name":90,"show_sort_weight":91,"slug":92},12,"Resumes",80,"resumes",{"id":94,"doc_module":22,"doc_module_name":25,"category_name":95,"show_sort_weight":96,"slug":97},14,"Invoices",70,"invoices",{"id":99,"doc_module":22,"doc_module_name":25,"category_name":100,"show_sort_weight":101,"slug":102},15,"Posters",60,"posters",{"id":104,"doc_module":22,"doc_module_name":25,"category_name":105,"show_sort_weight":106,"slug":107},16,"Social Media",50,"social-media",{"id":109,"doc_module":22,"doc_module_name":25,"category_name":110,"show_sort_weight":111,"slug":112},17,"Forms",40,"forms",{"id":114,"doc_module":22,"doc_module_name":25,"category_name":115,"show_sort_weight":116,"slug":117},18,"Letters",30,"letters",{"id":119,"doc_module":22,"doc_module_name":25,"category_name":120,"show_sort_weight":121,"slug":122},21,"Paper Templates",5,"papers-templates",{"id":124,"doc_module":22,"doc_module_name":25,"category_name":29,"show_sort_weight":4,"slug":125},158,"general-158",{"code":4,"msg":81,"data":127},{"doc_id":78,"user_id":128,"nickname":42,"user_avatar":129,"doc_module":22,"category_id":124,"category_name":29,"doc_title":10,"doc_description":12,"doc_content":130,"file_id":131,"file_url":132,"file_type":133,"file_size":134,"view_count":30,"is_deleted":4,"is_public":22,"is_downloadable":22,"audit_status":22,"page_count":26,"language":135,"language_code":8,"site_id":7,"html_lang":8,"table_of_contents":136,"faqs":137,"seo_title":138,"seo_description":12,"update_tm":139,"read_time":22},1374402968488,"https://ap-avatar.wpscdn.com/davatar_29158cc5080c5b710cf443261637dec0","Data Visualization  \nwith ggplot2  \nCheat Sheet  \nBasics  \nggplot2 is based on the grammar of graphics, the idea that you can build every graph from the same few components: a data set, a set of geoms—visual marks that represent data points, and a coordinate  \nsystem.  \n+  \ndata geom  \nx = F  \ny = A  \ncoordinate plot system  \nTo display data values, map variables in the data set to aesthetic properties of the geom like size, color, and x and y locations.  \n+  \n\n| F | M | A |\n| --- | --- | --- |\n|  |  |  |\n|  |  |  |\n|  |  |  |\n|  |  |  |\n|  |  |  |\n|  |  |  |\n\ndata geom  \nx = F  \ny = A color = F size = A  \n4  \n3  \n= 2  \n1  \n0  \n0 1 2 3 4  \ncoordinate plot system  \nBuild a graph with ggplot() or qplot() ggplot(data = mpg, aes(x = cty, y = hwy))  \nBegins a plot that you finish by adding layers to. No defaults, but provides more control than qplot() .  \nggplot(mpg, aes(hwy, cty)) + geom_point(aes(color = cyl)) + geom_smooth(method =\"lm\") + coord_cartesian() + scale_color_gradient() + theme_bw()  \ndata  \nadd layers,  \nelements with +  \nlayer = geom + default stat + layer specific mappings  \nadditional elements  \nAdd a new layer to a plot with a geom_ *() or stat_ *() function. Each provides a geom, a set of aesthetic mappings, and a default stat and position adjustment.  \nqplot(x = cty, y = hwy, color = cyl, data = mpg, geom = \"point\") Creates a complete plot with given data, geom, and mappings. Supplies many useful defaults.  \nlast_plot()  \nReturns the last plot  \nggsave(\"plot.png\", width = 5, height = 5)  \nSaves last plot as 5’ x 5’ file named \"plot. png\" in working directory. Matches file type to file extension.  \naesthetic mappings   \ndata  \ngeom  \nGeoms -Use a geom to represent data points, use the geom’s aesthetic properties to represent variables. Each function returns a layer.  \nGraphical Primitives   \n a \u003C-ggplot(seals, aes(x = long, y = lat))   \nb \u003C-ggplot(economics, aes(date, unemploy))  \na + geom_blank()  \n(Useful for expanding limits)  \na + geom_curve(aes(yend = lat + delta_lat, xend = long + delta_long, curvature = z)) x, xend, y, yend, alpha, angle, color, curvature, linetype, size  \nb + geom_path(lineend=\"butt\", linejoin=\"round’, linemitre=1)  \nx, y, alpha, color, group, linetype, size b + geom_polygon(aes(group = group))  \nx, y, alpha, color, fill, group, linetype, size a + geom_rect(aes(xmin = long, ymin = lat,  \nxmax= long + delta_long, ymax = lat + delta_lat))  \nxmax, xmin, ymax, ymin, alpha, color, fill, linetype, size b + geom_ribbon(aes(ymin=unemploy-900,  \nymax=unemploy + 900))  \nx, ymax, ymin, alpha, color, fill, group, linetype, size a + geom_segment(aes(yend=lat + delta_lat,  \nxend = long + delta_long))  \nx, xend, y, yend, alpha, color, linetype, size a + geom_spoke(aes(yend = lat + delta_lat,  \nxend = long + delta_long))  \nx, y, angle, radius, alpha, color, linetype, size  \nOne Variable   \n Continuous   \nc \u003C-ggplot(mpg, aes(hwy))  \nc + geom_area(stat = \"bin\")  \nx, y, alpha, color, fill, linetype, size  \na + geom_area(aes(y = ..density..), stat = \"bin\")  \nc + geom_density(kernel = \"gaussian\") x, y, alpha, color, fill, group, linetype, size, weight  \nc + geom_dotplot()  \nx, y, alpha, color, fill  \nc + geom_freqpoly()  \nx, y, alpha, color, group, linetype, size a + geom_freqpoly(aes(y = ..density..))  \nc + geom_histogram(binwidth = 5) x, y, alpha, color, fill, linetype, size, weight a + geom_histogram(aes(y = ..density..))  \nDiscrete  \nd \u003C-ggplot(mpg, aes(fl))  \nd + geom_bar()  \nx, alpha, color, fill, linetype, size, weight  \nTwo Variables  \nContinuous X, Continuous Y  \ne \u003C-ggplot(mpg, aes(cty, hwy))  \ne + geom_label(aes(label = cty), nudge_x = 1, nudge_y = 1, check_overlap = TRUE)  \nx, y, label, alpha, angle, color, family, fontface, hjust, lineheight, size, vjust  \ne + geom_jitter(height = 2, width = 2) x, y, alpha, color, fill, shape, size  \ne + geom_point()  \nx, y, alpha, color, fill, shape, size, stroke  \ne + geom_quantile()  \nx, y, alpha, color, group, linetype, size, weight e + geom_rug(sides = \"bl\"","cbCaif4VI9ktaOwz","https://ap.wps.com/l/cbCaif4VI9ktaOwz","pdf",971277,"English","# Basics\n## Grammar of graphics concepts\n## Plot construction with ggplot() and qplot()\n## Layers and geoms\n## Geom primitives overview\n## One-variable geoms\n## Two-variable geoms\n## Bivariate distributions\n## Continuous functions\n## Visualizing error\n## Maps","[{\"question\":\"What are the main components of a ggplot2 plot?\",\"answer\":\"ggplot2 follows the grammar of graphics: a data set, geoms (visual marks representing data points), and a coordinate system.\"},{\"question\":\"How do aesthetic mappings work in ggplot2?\",\"answer\":\"Aesthetic mappings connect variables from the data set to visual properties such as size, color, and x/y positions of a geom.\"},{\"question\":\"How can a plot be extended in ggplot2?\",\"answer\":\"Start with ggplot() (or qplot()), then add layers using geom_*() or stat_*() functions, which provide geoms, mappings, and default statistics.\"}]","Data Visualization - ggplot2 Cheat Sheet - Basics | PDF",1791929123]