Module 6: Advanced Plotting in R

Size: px
Start display at page:

Download "Module 6: Advanced Plotting in R"

Transcription

1 Module 6: Advanced Plotting in R The purpose of this handout is to teach you the basic elements of making advanced graphics in R. You do not need to have completed Modules 1-4 in order for this Module to be useful, although having familiarity with teh RxP dataset may be useful. Hopefully, you will be able to translate the examples given here into versions using your own data with relative ease! This handout will cover the following analyses: Basic principles of making better figures Making better figures using R s base graphics functions Using the ggplot2 package to make better figures and explore your data 1 Basic Principles of Making Better Figures What makes a nice looking figure, one that is suitable for publication or use in a presentation? I would argue that judicious use of color, large clear text and labels, and efficient usage of plot space are three hallmarks of a good figure. It is often useful to create multiple panels to show different aspects of your data. These fundamentals are the same whether you are making your figures in R or not. There are two main ways to make figures in R: base graphics (i.e., those that are built in to the base version of R you have downloaded from CRAN) and using the package ggplot2. There are functions in other packages that can be useful (e.g., the scatterplot() function in the car package, or the barplot2() function in the gpots package) but these all utilize the basic coding of base graphics. While ggplot2 uses a distinct coding lingo from base graphics, the fundamentals that make an effective graphic remain the same. Below, you will be introduced to many different optional arguments and functions that can improve the look of your figures. As with anything related to R, we cannot possibly cover every different argument or function, and in many instances there are multiple ways to get to the same endpoint. 1.1 Building plots in R: piece-by-piece As you start to think about an advanced figure, perhaps a scatterplot with points of different colors (or different types of points) with best fit lines from a GLM, and confidence intervals around those curves, the first thing to think about is how you will want the final product to look and what objects need to be on top of others in order for everythig to be seen. Think of each type of object you are adding (lines, confidence intervals, points, etc.) as a layer and you need each layer to be visible for the figure to work best. For example, if you want to plot a filled in confidence interval, it will likely cover up points of the scatterplot and the best fit line. Thus, the confidence interval should actually be plotted first, even if that seems counter-intuitive. Then, the scatterplot points, then the best fit line. This requires several lines of code but allows you to make the figure exactly how you want it. And remember, if you plot a legend or change an axis and it is on top of something else, you simply adjust it, highlight all the code for the figure and rerun it. Touchon (2016) Page 1 of 23

2 2 Making advanced plots using base graphics 2.1 Arguments Here is a long list of arguments that can be used to adjust the look of your figure. Note that these are explained in the help files for plot() and par(). We will discuss how to use par() more specifically in the next section. The arguments below all go in the basic call to make the plot, but many will also work on subsequent plotting functions like lines() or points(). Also note that there are many more arguments besides these, but these are the ones you are most likely to want to change. type: in a basic plot allows you set if you want, for example, a scatterplot (type="p"), lines (type="l"), both points and lines connecting them (type="b"). You can also specify a blank plot area with type="n". main: allows you to specify a title at the top of the plot. xlab and ylab: allows you to specify the x-axis label and y-axis label however you choose. cex: sets the relative size of points in a points and text in a plot. Everything starts with a value of 1, so setting cex values larger than 1 make points or text relatively larger, whereas setting values smaller than 1 makes items smaller. Note that in most plots cex by itself will change the size of plotted points, whereas arguments such as cex.axis will change the size of printed values in the x- and y-axes, or cex.lab will change the relative sizes of x- and y-axis labels. col: sets the color of objects in the plot. In general, col will set the color of whatever the principle thing you are plotting is (points in a scatterplot, lines if you are plotting just lines). Like cex, you can use col to change the colors of many independent things. For example, col.axis will change the colors of the text in the axes, col.lab will change the color of the x- and y-axis labels, etc. Color can be defined in many ways which will be discussed in a subsequent section. pch: sets the plotting character which is just a way of saying the type of point (circle, triangle, square, etc.). See?pch for a list of all possible options. Note that most characters are simply one color, and are either solid or hollow, but options are filled and can have two colors, the border and the fill. See bg below. Note that you can also specify that you want to plot text instead of symbols by using quotations after the pch argument. fg: sets the foreground color, which is the color of the lines in the axes and the box around the plot. bg: sets the background color. If used in the call of par() it will define the background color of the entire plot window. If used in the plot() or points() functions, it will draw the fill color of points that are filled in (pch 21-25). Note that for these plotting characters, the argument col will set the border color and that bg is needed to set the fill color. las: changes the orientation of the axis numbers relative to the tick marks. Setting las=1 will rotate the y-axis values 90 degrees so they are read more easily, setting las=3 will rotate just the x-axis values 90 degrees (useful if you have, for example, long titles underneath bars or dates on the x-axis). Touchon (2016) Page 2 of 23

3 bty: defines the box type, which is the box around the plot area. The default is a box all the way around, except for bar plots which do not have a box around them. You can define various sides of the box to draw using different letters or numbers that vaguely resemble the sides of a box. For example, bty="c" will draw three sides of a box, on the top, left and bottom, or bty="7" will draw just the top and right side. Defining bty="n" completely suppresses the box, even though an n looks like it should draw the left, right and top sides. Go figure. lty: sets the line type. The following options are built in: 0 (no line), 1 (solid line, the default setting), 2 (dashed line), 3 (dotted line), 4 (dot-dash line), 5 (long dashed line), 6 (two dashed line). Note that you can design essentially any type of dashed line you might want. This is done by specifying an even number of digits, each of which corresponds to 1) the number of line units to be drawn and 2) the number of line units to be skipped. Thus, specifying lty="44" would make a simple dashed line of 4 units drawn, 4 units skipped. Similarly, setting lty="4222" would specify a line of 4 units, followed by a gap of 2, then a short line of 2 units and another gap of 2 units, before repeating back to the 4 unit length. Lines specified in is manner must be an even number of digits, to specify a gap length for every drawn length. lwd: sets the relative line width. Increasing values make thicker lines. tcl: sets the length and direction of tick marks on the axes. The default is scored as Thus, to make tick marks face inward into the plot, set a value larger than 0. xaxt and yaxt: sets if you want to suppress the production of either the x- or y-axis. This is useful if you want your axis to say something other than what is actually coded in your data frame. xpd: sets if you want to clip the plotted figure to just the figure region (set xpd=t) or to the whole plot window (set xpd=f). > #basic plot from Module 3 > plot(svl.final~age.dpo, data=rxp.bytank, main="a basic figure") > SVL.line<-exp( *log(35:145)) > lines(x=35:145, y=svl.line, lwd=2) > #a figure that has employed lots of little changes > plot(svl.final~age.dpo, data=rxp.bytank, xlab="age at metamorphosis (days post-oviposition)", ylab="final SVL of metamorphs", pch=22, bg="green", las=1, main="a more dressed up figure") > SVL.line<-exp( *log(35:145)) > lines(x=35:145, y=svl.line, lwd=4, lty="8424", col="dark blue") Here are a few other useful functions to know for customizing your plot: box(): this function merely draws a box around your plot area. This is most useful in barplots, where the box is not automatically drawn. lines(): draws a line or lines within the existing plot window. Useful for adding nonlinear regression lines or confidence intervals. Requires at least two sets of x- and y-coordinates and will draw a line between them. points(): draws a point or set of points in the existing plot window. Point style can be chosen using the pch= argument, as described above. Touchon (2016) Page 3 of 23

4 Figure 1: The figure on the left is made entirely with default settings, whereas the figure on the right has utilized quite a few arguments to change the appearance of it. It s not particularly nice looking, but you get the point I hope. axis(): this function allows you to modify or edit any axis (i.e., any of the four sides of the plot). This is particularly useful if you have data stored as a numeric variable but want the axis to have text. legend(): draws a legend anywhere you specify it in the plot window. The placement of the legend is either determined by x- and y-coordinates or simply by defining a location such as x="topleft" or x="bottomright". By default a box is drawn around the legend, so use bty="n" to get rid of it, as above. text(): allows you to add text anywhere on the figure. Simply set the location with x- and y-coordinates and the desired text with the argument labels=. This is useful to add, for example, letters or asterisks to denote statistical significance between treatments. segments(): allows you to draw a line anywhere on the figure from one set of x- and y-coordinates to another. polygon(): allows you to draw a polygon of any shape in the plot window by specifying a series of x- and y-coordinates. Can be used to plot confidence intervals (see below). 2.2 Setting the plot window parameters with par() Before you actually call your plot, it is often helpful to set up the parameters of the plot window itself, which is done using the function par(). Probably the most useful thing you do in par() is to set if you want multiple frames or panels to plot in. Touchon (2016) Page 4 of 23

5 2.2.1 Setting up multiple frames per plot window The par() function takes many possbile arguments (see?par), the most useful of which is mfrow or mfcol, which stand for multiple frames per row or multiple frames per column, respectively. These two arguments do the same thing, they are merely oppposites of one another. Simply specify the number of plots per row or column as a two number vector. For example, to make a plot window that has three plots side-by-side, you would specify par(mfrow=c(1,3)). You could achieve the same thing with par(mfcol=c(3,1)). The two panels in Figure 1 were made by specifying par(mfrow=c(1,2)). Using mfrow or mfcol will create evenly spaced and sized plots within the overall plot area. What if you want to set up differently sized panels within the plot window? This can be done via the layout() function. This can be a little tricky at first, but what you do is specify a matrix with the number of units in each row/column that you want. For example, the following code creates a hypothetical grid 6 units wide and 2 units tall, and we specify within that that the first row will have two plot frames three units wide, whereas the second row will have three plot frames that are each two units wide. The layout can be seen in Figure 1. Note that you do not have to actually create an object of the matrix, you can do that directly within the layout() call itself. > ##Makes panel different sizes > layout.matrix<-matrix(c(1,1,1,2,2,2,3,3,4,4,5,5), 2, 6, byrow = TRUE) > layout.matrix > layout.matrix #let s see what the matrix looks like [,1] [,2] [,3] [,4] [,5] [,6] [1,] [2,] > layout(layout.matrix) The par() function can also be used to define the spacing between panels within a plot using the mai or mar arguments, which specify the size of each frames margin in either inches or lines, respectively. Similarly, you can change the outer margin of the entire plot window with the omi or oma arguments, which define space in inches or lines. For any of these arguments, pass a vector of four values which correspond to the bottom, left, top and right sides, in order. 2.3 Defining colors As with so many things in R, there are multiple ways to define what colors you want to use. Each system has its pros and cons Numerical colors If you are just making a simple plot to explore your data, the easiest way to define color is by just using one of the nine basic numbered colors (e.g., col=1). These are as follows: 0=white, 1=black, 2=red, 3=green, 4=blue, 5=light blue, 6=fuschia, 7=yellow, 8=grey. If you try to name a color higher than 8, the palette wraps back around to 1. Thus, 9 is the same as 1 (black), 10 is the same as 2 (red), etc Named colors R has 657 named colors stored and ready to use. The full list of these can be viewed by typing colors() (or if you prefer, colours()) at the command prompt. Using named colors is nice because you probably Touchon (2016) Page 5 of 23

6 Figure 2: A complex layout is designed by specifying a matrix which defines the relative number of panels to put in each row or column. have an intuitive sense of what slate grey is going to look like, whereas a color defined by its red, green and blue (RGB) values is less obvious. If you need to know what the exact RGB values of a named color are, simply use the function col2rgb() and place the name of the color in quotes in the parentheses. For example, col2rgb("yellow") would tell you the RGB values for yellow in R RGB colors R allows you to define colors based on their RGB values. This is particularly useful if you have a color scheme you want to match, perhaps for a presentation in MS Powerpoint or Apple Keynote, and so you can specify the exact RGB color you are looking for, a color you have likely ascertained in another program. Colors are defined as RGB using the rgb() function. The default is that all values have a minimum of 0 and a maximum of 1, but you can set the max value to be 255 if you wish (which is likely the way colors are defined in any other program of your choosing). Lastly, you can also make an RGB color translucent by adjusting the alpha level (note that alpha is always on the same scale as the RGB values). For example, to set a color that was pure red but was slightly translucent, you would type the following. > col=rgb(255, 0, 0, maxcolorvalue=255, alpha=180) Hex colors Technically, R actually stored color in a system called hexadecimal, which defines each color (red, green, or blue) in terms of two values that range from 0-9, then from A-F, giving a total of 16 different values for each character. Thus, since each color is defined in terms of two number/letter combos, each color Touchon (2016) Page 6 of 23

7 has 256 different possible values (the same as we see with RGB!!). Although the code for hexadecimal may not be intuitive, it is easy to look up exactly what the color is you want to use online. The main advantage over RGB is that it is very compact to specify whatever color you want. In R, the hex color code goes in quotes and is preceded by a #. An additional two characters can be added to define a degree of translucency. For example, the translucent red color defined above would be as follows: > col="#ff0000b4" 2.4 Making easier figures in base graphics with gplots In Module 2 you learned how to add error bars to an existing boxplot using the barplot() function. You might have thought to yourself this is ridiculous and you would have been somewhat correct. Luckily, the package gplots has some slightly advanced versions of the basic graphing functions. For example, the function barplot2() contains an argument to easily add error bars. You still must specify how far from the mean each error bar is, but at least it will automate the x-axis spacing for you. Notice how the error bars (aka confidence intervals) are defined: set plot.ci=t then give the location of the upper and lower bounds by setting ci.u and ci.l, respectively. For example, using the metamorph.mean and metamorph.se objects we created in Module 2, you can make a nice looking barplot with the following code: >barplot2(metamorph.mean[,3], ylim=c(16,21), ylab="mean SVL of metamorphs SE (mm)", space=c(0,0,0,0.5,0,0), xpd=f, col=c("light green","green","dark green"), las=1, cex.lab=1.4, plot.ci=t, ci.u=metamorph.mean[,3]+metamorph.se[,3], ci.l= metamorph.mean[,3]-metamorph.se[,3]) >axis(side=1, at=c(1.5, 5), labels=c("high resource diet", "Low resource diet"), cex.axis=1.4) >legend(x=3.2, y=21, legend=c("control","non-lethal predator","lethal predator"), col=c("light green","green","dark green"), bty="n", pch=15, cex=1.5) >box() Another aspect of the code above that might seem cumbersome is the space= argument, whereby you group the bars how you want. One way around this is to restructure the metamorph.mean and metamorph.se objecs from data frames into matrices. We can even include our labels as our row and column names, which will allow us to easily label our bars and create a legend. Recall the structure of the objects we made in Module 2. > metamorph.mean Pred Res mean 1 C Hi NL Hi L Hi C Lo NL Lo L Lo > metamorph.se Pred Res SE 1 C Hi Touchon (2016) Page 7 of 23

8 2 NL Hi L Hi C Lo NL Lo L Lo If we transform those objects into matrices, plotting them the way we want will be easy! All we have to do is place the values that are in the 3rd column of each object into the matrices, as in the code below. You can define the names of the rows and columns with the dimnames argument, which is a list that gives the row names followed by the column names. Note that we only need to set the names for the object that will be the main subject of the plot (the mean values) and not the SE s. > metamorph.mean.mat<-matrix(metamorph.mean[,3], nrow=3, ncol=2, dimnames=list(c( "Control","Nonlethal","Lethal"), c("high Resources","Low Resources"))) > metamorph.se.mat<-matrix(metamorph.se[,3], nrow=3, ncol=2) > metamorph.mean.mat High Resources Low Resources Control Nonlethal Lethal Now we can make our bar graph and the bars will be grouped how we want them automatically. We can even add a legend by merely using the argument legend=t. > barplot2(metamorph.mean.mat, beside=t, ylim=c(16,22), ylab="mean SVL of metamorphs SE (mm)", xpd=f, col=c("light green","green","dark green"), las=1, cex.lab=1.4, legend=t, plot.ci=t, ci.u=metamorph.mean.mat+metamor ph.se.mat, ci.l=metamorph.mean.mat-metamorph.se.mat) > box() Figure 3: A nice looking barplot made with the function barplot2. The gplots package has several other handy features, for example to create a gradiant of colors from blue to red (bluered()) or green to red (greenred()), to plot venn diagrams (venn()), or to quickly plot group means and confidence intervals using a formula syntax (plotmeans()). Touchon (2016) Page 8 of 23

9 2.5 Using polygons() to create shaded confidence intervals It is quite straightforward to use the predict() function to generate a predicted line or curve from a model, along with appropriate 95% confidence intervals (see Modules 3 and 4 for details on using predict()). From those estimates, it is easy to use the function lines() to plot the confidence intervals around your predicted regression fit. But what if you want to make the confidence intervals a shaded region? You can do so with the function polygons(). As mentioned earlier, polygons() simply takes a series of x- and y-coordinates and connects them to create shape of your desire. In Module 3, we made a linear model (lm4) which examined the effect of log-transformed age at metamorphosis (in days post-oviposition) on the final SVL of metamorphs (also log-transformed). We then the predict() function to create and plot confidence intervals back on the original scale of the raw, untransformed data. As a reminder, the code to generate the CI s is below. > lm4<-lm(log.svl.final~log.age.dpo, data=rxp.bytank) > lm4.newdata<-data.frame("log.age.dpo"=seq(3.64,4.94,0.01)) > lm4.predicted<-predict(lm4, newdata=lm4.newdata, se.fit=t) > str(lm4.predicted) List of 4 $ fit : Named num [1:131] attr(*, "names")= chr [1:131] "1" "2" "3" "4"... $ se.fit : Named num [1:131] attr(*, "names")= chr [1:131] "1" "2" "3" "4"... $ df : int 76 $ residual.scale: num To create the shaded polygon that is the CI, we just need a two-column table of x- and y-values that start at one corner and tell the polygon where to go. Thus, we can use cbind() to bind together two columns one of x-values (from start to finish of the x-axis and back again) and the corresponding y-values. Since the predict function has all our y-values (both the lower and upper CI) ordered from low to high as the correspond to the x-axis, we can use the function rev() to reverse the order of one set (let s do it for the upper CI). The code below merely makes a two-column table, one that is a sequence from 35 to 145 and then from 145 back to 35 (our x-coordinates) and then a second column that is the predicted means minus the CI (the lower CI) and then the reversed predicted means plus the CI (the upper CI). > CI.poly<-cbind(c(seq(35,145),seq(145,35)),c(exp(predict.line$fitpredict.line$se.fit),rev(exp(predict.line$fit+predict.line$se.fit)))) Lastly, we plot it all. We want to plot the polygon first, since it would cover up some of the data points, so we first make a blank plot by specifying type="n". > plot(svl.final~age.dpo, data=rxp.bytank, type="n", ylab="final metamorph SVL (mm)", xlab="age at metamorphosis (days post-oviposition)", cex.lab=1.4, las=1) > polygon(ci.poly, col="grey80", lty=0) > points(svl.final~age.dpo, data=rxp.bytank) > lines(x=35:145, y=exp(predict.line$fit), lwd=2) Touchon (2016) Page 9 of 23

10 Figure 4: A nonlinear regression with shaded confidence interval, plotted using base graphics. 3 Plotting using ggplot2 In recent years, the ggplot2 package has become increasingly popular for making nice looking figures with relative ease. In particular, ggplot2 is excellent for exploratory data analysis, as it easily allows you to plot (for example) histograms for each of your groups or on top of one another. You can easily add linear regression lines and confidence intervals to a scatterplot. But ggplot2 is not just restricted to EDA and can be used to make pretty much any type of graphic you want, you just have to know how (which is, of course, the same dilemma in base graphics!). This document cannot attempt to teach you everything you need to know about using ggplot2 but is merely meant to give you an introduction and provide you with tools to get started. The downside of ggplot2 is that it uses a very different syntax from base graphics. The basic ideas are the same, in that you layer objects together to create a final product, but the way you get there is quite different. ggplot2 is part of an emerging universe of packages written by Hadley Wickham, the chief data scientist at RStudio (and adjunct professor of statistics at Rice University). If you become familiar with the style and syntax of ggplot2 it should be relatively straightforward to use Wickham s other packages such as dplyr or tidyr, which can be very useful for data manipulation and organization. It is useful to point out that the folks at RStudio have made some very handy cheatsheets for using these packages. I highly recommend checking them out. cheatsheets/ It is also useful to know that the 2nd edition of Wickham s book on ggplot2 is freely available on the web. although having the physical copy is very useful and I encourage purchasing it. 3.1 The basics of ggplot2 There are two basic functions that do all the heavy lifting for plotting: qplot(), which stands for quick plot and ggplot(). qplot() is great for EDA, as it makes intuitive nice looking figures with very little code. However, if you want to make truly professional and custom figures, you will want to use ggplot(). In both cases, you have the following basic elements: You assign the data you are going to use up front, using the data argument. Touchon (2016) Page 10 of 23

11 You assign aesthetics such as the colors you want to use, what data will be on the x-axis or y-axis, etc., using the aes argument. You assign the basic style of the graphic (e.g., scatterplot, histogram, etc) using the geom argument, short for geometric objects. You can also use the following arguments to further customize your graphic: You can divide your plot into multiple panels, or facets, using the facets argument. You can change the automatically generated coordinate system with the coord argument. You can change aspects of the axes or size of the plotted objects with the scales argument. 3.2 Getting started with qplot() Back in Modules 2 and 3, we made some simple scatterplots and histograms to explore basic relationships in the RxP data. If you have worked through Module 5, you have even seen how to plot multiple histograms on top of one another. If you want to make a simple histogram of, for example, the distribution of final metamorph SVL s, it is as easy as: > qplot(svl.final, data=rxp.clean, geom="histogram") Figure 5: A very boring histogram of metamorph SVL s. Notice the setup of the code above. Instead of using a function to specify the specific type of plot we want to make (e.g., hist()) we use a more generic plotting function (qplot()) and then specify the type of plot we want to make with the geom argument. In addition, we just list the column we want to plot and provide the data frame where the data can be found. In truth, if you do not provide a geom to use, qplot() will guess what you want to use (and histograms are the default for continuous numerical data). This figure does not make use of any of ggplot2 s unique features. For example, what if we want to examine histograms for each of our predator treatments? Below are two examples of how Touchon (2016) Page 11 of 23

12 you might compare the three treatments by plotting the histograms together. Note that all we have to do is specify how we want the geom to be colored or filled and qplot() knows what to do. The first line of code changes the color of the outside of the bars, whereas the second example changes the fill of each bar. The third example is not a histogram but instead a density plot, which gives you an idea of the relative breadth of data in each treatment. > qplot(svl.final, data=rxp.clean, geom="histogram", col=pred) > qplot(svl.final, data=rxp.clean, geom="histogram", fill=pred) > qplot(svl.final, data=rxp.clean, geom="density", col=pred) Figure 6: Three different ways you might view the distributions of different treatment groups on top of one another for easy comparison. Yet another way to view these histograms would be to use ggplot2 s faceting feature, which easily allows us to split a single figure into multiple panels which allow easy visual comparison. For example, we can use the facets argument to specify how we want our figure split apart. For example, if we want to examine histograms for each combination of predation and resource treatment, we can easily do so by typing the following: > qplot(svl.final, data=rxp.clean, geom="histogram", facets=res~pred, fill=pred) One great thing about the faceting feature is that all panels are placed on the exact same axes, so that they are easily comparable as you look across them. The important thing to note about the code specifying the facets is that you must specify what data should be plotted in both the rows and columns. In the example above, we plotted rows (the left hand side of the ~) based on resource treatment, and columns based on predation treatment. If you only want to plot the plots next to one another (for example), we would have placed a period (.) on the side we wanted blank, as in facets=.~pred. We can make a large number of different plots using just the basic qplot() function. For example, we can make boxplots, violin plots, scatterplots, etc. For example, perhaps we want to quickly look at the box and whisker plots of all of our 12 treatment combinations. This is easily accomplished by plotting SVL against one treatment, then faceting based on the other two. > qplot(res, SVL.final, data=rxp.clean, geom="boxplot", facets=hatch~pred, fill=res) We can even make a very cool variation of a scatterplot using qplot() commonly called a bubblechart. This is accomplished by assigning the size of points to be based on some continuous variable Touchon (2016) Page 12 of 23

13 Figure 7: Data on SVL has been plotted for each combination of predator and resource treatment, and then filled based on predator treatment. Figure 8: Data on SVL has been plotted for each resource treatment, and then faceted by predator and hatching treatments. in our dataset. For example, in Module 4 we created a variable called NumKilled which was the number of tadpoles that were killed in each mesocosm. We can easily specify that the size of points should be determined by the values in our NumKilled column. We can also make our points partially translucent by specifying an alpha level. Specifying alpha=1/5 indicates that 5 points on top of one another would be completely opaque. > qplot(age.dpo, SVL.final, data=rxp.bytank, size=numkilled, col=res, alpha=1/5) Lastly, we can even add a linear regression with confidence intervals to a scatterplot using qplot(). All we do is make a scatterplot and then add to it a second geom argument to make a smooth line, we can add the regression fit with CI. You would still want to run the lm model and inspect the summary() output as you do not receive any actual statistical information from qplot() (i.e., this is just for visualization). Note that the default is a smoothed curve and not a linear regression, so do add a regression fit we specify method=lm. Also note that while this is very easy to do for an lm it is more difficult for glm s or other models (which we will cover in the next section). Touchon (2016) Page 13 of 23

14 Figure 9: Data on SVL has been plotted against age at metamorphosis with points colored for each resource treatment, and sized based on the number of animals that were killed in each tank. > qplot(log(age.dpo), log(svl.final), data=rxp.bytank)+geom_smooth(method=lm) Figure 10: A linear regression with confidence interval is shown plotted on the scatterplot of log(svl.final) against log(age.dpo). Plotting regressions is easy with ggplot2! We can even combine the faceting we did earlier for simple figures like histograms with the model fitting that is occuring when we specify the geom_smooth(method=lm). The key here is that once we specify something like facets or colors, any commands that follow will assume those rules. Although Figure 11 looks very complicated, the principles are exactly the same. We ve just specified (in this order), the x-axis variable, the y-axis variable, where the data are, the color to split the data by, the variable to facet the data by and that we want to add linear regressions. > qplot(log(age.dpo), log(svl.final), data=rxp.clean, col=pred, facets=.~res, alpha=.01) + geom_smooth(method=lm) Touchon (2016) Page 14 of 23

15 Figure 11: Linear regressions with confidence intervals are shown for each predator and resource treatment combination, plotted for log(svl.final) against log(age.dpo). Wow, that was amazingly easy! One last thing before we move on. How do you create multiple plots in a single window but that are not facets of the same plot, like what we did with layout() or par(mfrow=c(1,2))? In ggplot2, there are several different options. Perhaps the easiest is to use the grid.arrange function in the gridextra package. For example, to create the 2 x 3 panel of plots a-f you see in Figure 12, I used the code below. Simply assign your plots to objects, provide the list of all the objects to plot and how many columns or rows you want. Viola! grid.arrange(a,b,c,d,e,f, ncol=2, nrow=3) 3.3 Making more advanced plots using ggplot() Using the ggplot() function has two major effects: 1) it is more cumbersome to use because now you are responsible for coding more of the basic elements of the figure, but 2) it opens up the possibilities of the kinds of figures you can make, because now you have complete control. In some respects, using ggplot() becomes a process more similar to base graphics. Using qplot(), you are often interested in a quick look at your data and in exploring patterns. Thus, the default colors and symbols that are chosen for you are perfectly fine. And to be honest, the default parameters are often quite visually pleasing. However, when you want to specify exact colors or complex nonlinear regression fits (as just two examples), the process becomes more laborious. That said, once you get used to the language of ggplot2, it is likely that you will not want to go back to base graphics. We will explore two examples where we use ggplot() to make figures we have already shown how to make using base graphics, either in this module or earlier modules. Much like using base graphics, you add different elements to your plot one at a time. The main difference is that whereas adding a legend or a line to an existing plot merely adds a new object to an existing plot which does not change at all, adding new elements in ggplot() will actually change the overall look of the entire figure. This is because just like when you define how ggplot() will use colors to plot different aspects of your data, each element you add or define adds to the overall picture of how your plot will be created. As you will see, you often have to override default settings to get the exact plot you want. Touchon (2016) Page 15 of 23

16 Huge acknowledgements and thanks to Tim Thurman who showed me how to actually make these figures using ggplot()!! Making a bar graph with error bars using ggplot() Earlier in this Module we saw how to use a matrix to make plotting grouped bars (with error bars) a bit easier. However, having our data in a matrix does not work with ggplot(), which requires everything to be in a data frame. However, it is useful to have all of our data in a single object. We can easily create a new column in our metamorph.mean data frame to hold the SE values. Note that this sort of an object can also be created using the dplyr package (see the end of this document for the code of how to do exactly that). > metamorph.mean$se<-metamorph.se[,3] > metamorph.mean Pred Res mean SE 1 C Hi NL Hi L Hi C Lo NL Lo L Lo The first step is to create the plot object where we define 1) which data we are using, 2) what our x- and y-axes will be, and 3) what groups we want to split the data apart by. One of the important features of ggplot2 plots is that they are self-contained objects. In other words, while you can create a plot by just typing the code into the console, you can (and should) actually create an object and then plot that (if that doesn t make sense, you will see what I mean). The plot object actually contains a full copy of the dataframe you are using, which allows you to modify an existing plot object without having re-execute all of your code. Note that the progression of figures described below are shown in Figure 12. In the code below, we have said that our data come from the metamorph.mean object, and then we define our aesthetic mapping elements, using the aes() argument. We have defined that our x- axis is based on the Resource treatments, our y-axis is the mean column, and our data is going to be split apart by Predator treatments. In the second line, we have called our geom object, which in this case is geom_bar and we just want it to display the height of our means, which is the specification stat="identity". By default, the bars would be stacked on one another, so we have specified position = "dodge" to tell the geom to place them side-by-side. Lastly, recall the difference between color and fill, and that color determines the outline color of our bars. > a <- ggplot(data = metamorph.mean, aes(x = Res, y = mean, fill = Pred)) + geom_bar(stat = "identity", position = "dodge", color="black") > a Next, we can modify our plot a by adding to it a new geom object for error bars, geom_errorbar. At this point it should have become clear that the list of possible geoms is very large and they encompass about everything you might want to include in a plot. Anything that you actually want to draw in the plot will be a geom. As stated above, since the object a contains the information about the raw data and how we want to plot it (x- and y-axes, parsing the data based on resources and predators) we can merely Touchon (2016) Page 16 of 23

17 modify the plot by adding a new geom and creating a new object, which we will call b. In order to make our error bars be in the correct place, we have to add the argument position = position_dodge(.9). As we saw above, dodging is how we make things not on top of each other. So why dodge by 0.9? By default, ggplot() will make each group of bars (i.e., the three High Resource bars or the three Low Resource bars) 90% of the width between units. In layman s terms, if the distance between High and Low is 1, then the width of the set of bars is 90%, or 0.9. This carries through to the bars for each predator treatment; the center of the C and L bars are considered 0.9 from the center fo the NL bar. > b <- a + geom_errorbar(aes(ymin = mean - SE, ymax = mean + SE), position = position_dodge (.9), width = 0.2) > b As we saw in Module 2, plotting the y-axis all the way from 0 makes it somewhat difficult to see the differences between our three predator treatments. We can change the axis by overriding the default axis and specifying the cartesian coordinates to be used for the y-axis. > c <- b + coord_cartesian(ylim = c(16,20.5)) > c Next, we would like to override the default labels given to the x- and y-axes, which are generated from our original data frame. In the code below, notice two things. First, we have changed the x-axis by the use of a scale argument, namely scale_x_discrete(). In other words, because Hi and Lo are the actual values of our x-axis, we have to change them as a scale instead of simply a label. This is essentially what we would in base graphics as well. Secondly, we have already changed the y-axis with the earlier coord_cartesian() element, so here we are merely changing the label, just as we would with base graphics. > d <- c + scale_x_discrete(name = "Diet type", labels = c("low Resource", "High Resource" )) + ylab("mean SVL of metamorphs SE (mm)") > d Now we want to override the default colors that ggplot2 has chosen for us. To define a new set of colors for the bars, we can add a scale_fill_manual() element and provide it with labels which will be used in making the legend. Instead of typing everything in to the actual plotting element, we can define a separate object that holds just the names of the colors. This is not required, but does clean up the code for making the plot a little bit. > cols <- c("light green","green","dark green") > e <- d + scale_fill_manual(values = cols, name = NULL, labels = c("control", "Non-lethal predator", "Lethal predator")) > e Lastly, let s move our legend to the empty white space in our plotting area, which allows our bars to be plotted larger and makes more effective use of the overall space. The code below also does several Touchon (2016) Page 17 of 23

18 other things. First, we have defined a theme, which is just a set of basic layout options. In this case, the theme_classic() element means we do not want the grey background with grid lines. The only problem is that without the grey background, our x- and y-axes look pretty weird, so we have to add them back in by defining specifically that we want lines (element_line()). Lastly, we specify where we want the legend. The overall plot area is all defined in relative terms, with the lower left corner being 0,0 and the upper right corner being 1,1. Thus, through some trial and error we can determine where we want to place our legend. > f <- e + theme_classic() + theme(axis.line.x = element_line(), axis.line.y = element_line(), legend.position = c(.65,.85)) > f In the end, here is the code to make the final plot, plot f. > cols <- c("light green","green","dark green") > f <- ggplot(data = metamorph.mean, aes(x = Res, y = mean, fill = Pred)) + geom_bar(stat = "identity", position = "dodge", col="black") + geom_errorbar(aes(ymin = mean - SE, ymax = mean + SE), position = position_dodge(.9), width = 0.2) + coord_cartesian(ylim = c(16,20.5)) + scale_x_discrete(name = "Diet type", labels = c("low Resource", "High Resource")) + ylab("mean SVL of metamorphs SE (mm)") + scale_fill_manual(values = cols, name = NULL, labels = c("control", "Non-lethal predator", "Lethal predator")) + theme_classic() + theme(axis.line.x = element_line(), axis.line.y = element_line(), legend.position = c(.65,.85)) Plotting a nonlinear regression with ggplot() Now that we have seen the basic process for plotting continuous data against a discrete x-axis (i.e., a bar graph), let s explore how we might plot two continuous variables against one another, like we did earlier when we made Figure 4 (and in Modules 3 and 4). The data for metamorph SVL is lognormally distributed and has a linear relationship with age at metamorphosis once both are log-transformed (for a refresher of these data, see Module 3). Whereas ggplot2 has the ability to automatically plot linear regressions and associated confidence intervals, such features do not exist if you want to plot the results of a linear regression back on original data, which are inherently nonlinear, like we did in Modules 3 and 4. Similarly, if you are trying to plot the predicted fit of a linear or generalized linear mixed effects model, you will have to calculate the predicted fit and confidence intervals yourself, most likely using the predict() function (see Modules 3 and 4 for more details on using predict()). That said, the geom_smooth element can handle more than simple linear regressions and can easily plot ANCOVA (as we saw earlier) but also the results of GLM s, with non-gaussian data families. Because ggplot() likes all of our objects to be in data frames, it is necessary (or at least very helpful) to first create a data frame that contains the X and Y values for our predicted curve, as well as Touchon (2016) Page 18 of 23

19 Figure 12: Plots a-f show the progression of the figure as we add new elements one-by-one. Some features are created automatically, such as the colors that fill the bars and associated legend, but we can override these if we want to. Touchon (2016) Page 19 of 23

20 the upper and lower values for our confidence intervals. We did this in two different ways in Module 3: first we calculated the predicted curve directly from the regression coefficients, and secondly by using predict(). In fact, we did this earlier in this module when we made the SVL.line object. Here, instead of merely making a vector of the predicted values, we will use predict to make a data frame that contains everything we need. In the code below, remember that when we use predict() and set se.fit=t, it creates an list with two objects: the $fit and the $se.fit objects, and that the $se.fit object is merely how much the confidence interval is from the mean value. > lm1 <- lm(log(svl.final) ~ log(age.dpo), data = RxP.byTank) > predicted <- predict(lm1, data.frame(age.dpo = 35:145), se.fit = T) > fit.line <- data.frame(x = 35:145, Y = exp(predicted$fit), lower = exp(predicted$fit - predicted$se.fit), upper = exp(predicted$fit + predicted$se.fit)) Now we are ready to make our plot. This process is very analagous to how we created the plot like this in base graphics. Since we walked through each line in the last example, we won t do it again here. But, we can explain exactly what this code does. First, we name the object and that we are making it with ggplot(). Note that we do not tell the function the data here, as we did before. This is because we will be plotting from two different data frames. We are plotting the points from the RxP.byTank data frame, and the regression from our fit.line data frame. Thus, we have to tell each geom where to get the data for that specific object, instead of each geom inheriting the data from the previous line. Next, we plot our points by adding the geom_point() element. Notice that in addition to defining aestetics for the x- and y-axes and color as before, we can also plot the points based on different shapes. However, the default in ggplot2() is to first have filled in circles and then filled in triangles, which are not that easy to tell apart. It is much easier to tell the difference between open and filled points, so the following line overrides the default shape and manually sets the points to be either open circles (value of 1) or filled circles (value of 16). For a list of all of the available shapes, type?pch. The next line adds the regression line with geom_line(), which is essentialy the same as the lines() function in base graphics. To add the shaded confidence interval, we use geom_ribbon() element, which is equivalent to the polygon() function in base graphics we saw earlier. The last lines are the same as before, which clean up the plot space. > lm1.plot <- ggplot() + geom_point(data = RxP.byTank, aes(x = Age.DPO, y = SVL.final, color = Pred, shape = Res)) + scale_shape_manual(values=c(1,16)) + geom_line(data = fit.line, aes(x = X, y = Y)) + geom_ribbon(data = fit.line, aes(x = X, ymin = lower, ymax = upper), alpha =.2) + theme_classic() + theme(axis.line.x = element_line(), axis.line.y = element_line()) > lm1.plot A few things are worthwhile to mention at this point. The way that Figure 13 is built, line by line, is exactly the same as how we thought about building Figure 4. If you look closely at Figure 13, you will notice that the regression line and confidence interval are on top of the points. However, if you change the order of the code, so that geom_ribbon() comes before geom_line() which comes before geom_point(), this would not be the case. Touchon (2016) Page 20 of 23

21 Figure 13: A scatterplot of final metamorph SVL plotted against Age at metamorphosis, with points colored by predator treatment and shapes determined by resource treatment. The curve and shaded confidence interval are the predicted fit from a log-log linear regression. 4 The take-home message Making beautiful figures that are ready for publication is easily acheivable using either base graphics or ggplot2, and they share a lot in common. Particularly for making truly custom figures that look exactly how you want, you can (and need to) specify nearly every aspect of the figure, from the axis limits to the color scheme to the shape of the points. However, the nature of the coding is quite different and it will take some work to learn one if you are accustomed to the other. Some things are easier and take less code in base graphics (e.g., setting the x- or y-axis limits with the xlim= or ylim= arguments), whereas other things are much easier in ggplot2 (e.g., faceting, linear regression plots). If you are moving from base graphics to ggplot2, once you get the hang of the lingo it is really pretty easy to look up new things. Remember, your best friend in these matters is always Google. Simply searching for how do I adjust the x-axis in ggplot or whatever your question might be will almost always lead you to a solution rather quickly. 5 Appendix: a brief intro into dplyr and tidyr In Modules 2-4, we used the function aggregate() to coallate data into a compact form. One limitation of aggregate() is that you can only pass it one function to do at once (e.g., mean, length, sum, etc). However, packages dplyr and tidyr have several functions such as gather(), group_by() and summarise() that allow you to do the same thing as aggregate(), but with multiple functions at once. That said, it is a very different process to get from a to b. The code below was worked out by Tim Thurman, graduate student at McGill University (as of 2016 Touchon (2016) Page 21 of 23

22 when this was written). Well done Tim!! This first example does exactly what we did with aggregate() in Module 3 to make the RxP.byTank data frame. It is essentially the same amount of code but works in a very different way. The first thing to know is that the %>% code that is at the end of each line is called a pipe and it says that the product or output of one line should be the input for the following line. The output from the gather function is what is known as long data. The entire data frame of RxP.clean has been transformed to be rows long. How you ask? Why you ask? Great questions. The first line says we are going to use RxP.clean, then the gather() function says to use columns 8 through 14 of the original dataset and make two columns, one called measure and one called value. The measure column is just each column heading (aka variable name) from the original data frame, and the value column are all the values that were in those columns. Thus, if our original RxP.clean data frame was 2493 rows long, then in the new gathered data frame the first 2493 rows are for Age.DPO (the 8th column), the next 2493 are for Age.From Emergence (the 9th column), and so on. Remember, we specified to gather the 8t through 14th columns. The next two lines are more straightforward. Once we have our data in a long format we can group it by various categorical or continuous variables, such as Block, Pred, or Res (amongst others). Once we have grouped the data, we can summarize (or summarise, if you prefer, they both work) them based on some function. Here we have created a column called mean and the values in it are the means of the values in each group. At this point, the data are still in the long format, so we end by using the function spread() to move the values in the measure column back into column names and we place the values in the mean column in each appropriate place. Lastly, you will notice that data frames created in dplyr and tidyr look a little different. You can make look like regular data frames by using as.data.frame to reassign them to themselves. > RxP.byTank <- RxP.clean %>% gather(measure, value, 8:14) %>% group_by(block, Tank.Unique, Pred, Res, measure) %>% summarize(mean = mean(value)) %>% spread(measure, mean) > head(rxp.bytank) Source: local data frame [6 x 11] Groups: Block, Tank.Unique, Pred, Res [6] Block Tank.Unique Pred Res Age.DPO Age.FromEmergence Mass.final Resorb.days <int> <int> <fctr> <fctr> <dbl> <dbl> <dbl> <dbl> NL Hi C Hi C Hi L Lo NL Hi L Hi #... with 3 more variables: SVL.final <dbl>, SVL.initial <dbl>, Tail.initial <dbl> If you are used to more straightforward functions like aggregate() that code above and what it is doing might take a little time to wrap your head around. That s okay. Hopefully the explanation above will help you see what it is doing. Touchon (2016) Page 22 of 23

Data Visualization. Module 7

Data Visualization.  Module 7 Data Visualization http://datascience.tntlab.org Module 7 Today s Agenda A Brief Reminder to Update your Software A walkthrough of ggplot2 Big picture New cheatsheet, with some familiar caveats Geometric

More information

An Introduction to R Graphics

An Introduction to R Graphics An Introduction to R Graphics PnP Group Seminar 25 th April 2012 Why use R for graphics? Fast data exploration Easy automation and reproducibility Create publication quality figures Customisation of almost

More information

The first thing we ll need is some numbers. I m going to use the set of times and drug concentration levels in a patient s bloodstream given below.

The first thing we ll need is some numbers. I m going to use the set of times and drug concentration levels in a patient s bloodstream given below. Graphing in Excel featuring Excel 2007 1 A spreadsheet can be a powerful tool for analyzing and graphing data, but it works completely differently from the graphing calculator that you re used to. If you

More information

Logical operators: R provides an extensive list of logical operators. These include

Logical operators: R provides an extensive list of logical operators. These include meat.r: Explanation of code Goals of code: Analyzing a subset of data Creating data frames with specified X values Calculating confidence and prediction intervals Lists and matrices Only printing a few

More information

Facets and Continuous graphs

Facets and Continuous graphs Facets and Continuous graphs One way to add additional variables is with aesthetics. Another way, particularly useful for categorical variables, is to split your plot into facets, subplots that each display

More information

Introduction to the workbook and spreadsheet

Introduction to the workbook and spreadsheet Excel Tutorial To make the most of this tutorial I suggest you follow through it while sitting in front of a computer with Microsoft Excel running. This will allow you to try things out as you follow along.

More information

An Introduction to R 2.2 Statistical graphics

An Introduction to R 2.2 Statistical graphics An Introduction to R 2.2 Statistical graphics Dan Navarro (daniel.navarro@adelaide.edu.au) School of Psychology, University of Adelaide ua.edu.au/ccs/people/dan DSTO R Workshop, 29-Apr-2015 Scatter plots

More information

Install RStudio from - use the standard installation.

Install RStudio from   - use the standard installation. Session 1: Reading in Data Before you begin: Install RStudio from http://www.rstudio.com/ide/download/ - use the standard installation. Go to the course website; http://faculty.washington.edu/kenrice/rintro/

More information

Intro to R Graphics Center for Social Science Computation and Research, 2010 Stephanie Lee, Dept of Sociology, University of Washington

Intro to R Graphics Center for Social Science Computation and Research, 2010 Stephanie Lee, Dept of Sociology, University of Washington Intro to R Graphics Center for Social Science Computation and Research, 2010 Stephanie Lee, Dept of Sociology, University of Washington Class Outline - The R Environment and Graphics Engine - Basic Graphs

More information

1 Introduction to Using Excel Spreadsheets

1 Introduction to Using Excel Spreadsheets Survey of Math: Excel Spreadsheet Guide (for Excel 2007) Page 1 of 6 1 Introduction to Using Excel Spreadsheets This section of the guide is based on the file (a faux grade sheet created for messing with)

More information

Statistical transformations

Statistical transformations Statistical transformations Next, let s take a look at a bar chart. Bar charts seem simple, but they are interesting because they reveal something subtle about plots. Consider a basic bar chart, as drawn

More information

Intro. Scheme Basics. scm> 5 5. scm>

Intro. Scheme Basics. scm> 5 5. scm> Intro Let s take some time to talk about LISP. It stands for LISt Processing a way of coding using only lists! It sounds pretty radical, and it is. There are lots of cool things to know about LISP; if

More information

Types of Plotting Functions. Managing graphics devices. Further High-level Plotting Functions. The plot() Function

Types of Plotting Functions. Managing graphics devices. Further High-level Plotting Functions. The plot() Function 3 / 23 5 / 23 Outline The R Statistical Environment R Graphics Peter Dalgaard Department of Biostatistics University of Copenhagen January 16, 29 1 / 23 2 / 23 Overview Standard R Graphics The standard

More information

Data Visualization. Andrew Jaffe Instructor

Data Visualization. Andrew Jaffe Instructor Module 9 Data Visualization Andrew Jaffe Instructor Basic Plots We covered some basic plots previously, but we are going to expand the ability to customize these basic graphics first. 2/45 Read in Data

More information

An Introduction to R. Ed D. J. Berry 9th January 2017

An Introduction to R. Ed D. J. Berry 9th January 2017 An Introduction to R Ed D. J. Berry 9th January 2017 Overview Why now? Why R? General tips Recommended packages Recommended resources 2/48 Why now? Efficiency Pointandclick software just isn't time efficient

More information

Excel Basics Rice Digital Media Commons Guide Written for Microsoft Excel 2010 Windows Edition by Eric Miller

Excel Basics Rice Digital Media Commons Guide Written for Microsoft Excel 2010 Windows Edition by Eric Miller Excel Basics Rice Digital Media Commons Guide Written for Microsoft Excel 2010 Windows Edition by Eric Miller Table of Contents Introduction!... 1 Part 1: Entering Data!... 2 1.a: Typing!... 2 1.b: Editing

More information

03 - Intro to graphics (with ggplot2)

03 - Intro to graphics (with ggplot2) 3 - Intro to graphics (with ggplot2) ST 597 Spring 217 University of Alabama 3-dataviz.pdf Contents 1 Intro to R Graphics 2 1.1 Graphics Packages................................ 2 1.2 Base Graphics...................................

More information

plot(seq(0,10,1), seq(0,10,1), main = "the Title", xlim=c(1,20), ylim=c(1,20), col="darkblue");

plot(seq(0,10,1), seq(0,10,1), main = the Title, xlim=c(1,20), ylim=c(1,20), col=darkblue); R for Biologists Day 3 Graphing and Making Maps with Your Data Graphing is a pretty convenient use for R, especially in Rstudio. plot() is the most generalized graphing function. If you give it all numeric

More information

Getting started with ggplot2

Getting started with ggplot2 Getting started with ggplot2 STAT 133 Gaston Sanchez Department of Statistics, UC Berkeley gastonsanchez.com github.com/gastonstat/stat133 Course web: gastonsanchez.com/stat133 ggplot2 2 Resources for

More information

Graphics #1. R Graphics Fundamentals & Scatter Plots

Graphics #1. R Graphics Fundamentals & Scatter Plots Graphics #1. R Graphics Fundamentals & Scatter Plots In this lab, you will learn how to generate customized publication-quality graphs in R. Working with R graphics can be done as a stepwise process. Rather

More information

Introduction to R and the tidyverse. Paolo Crosetto

Introduction to R and the tidyverse. Paolo Crosetto Introduction to R and the tidyverse Paolo Crosetto Lecture 1: plotting Before we start: Rstudio Interactive console Object explorer Script window Plot window Before we start: R concatenate: c() assign:

More information

Data visualization with ggplot2

Data visualization with ggplot2 Data visualization with ggplot2 Visualizing data in R with the ggplot2 package Authors: Mateusz Kuzak, Diana Marek, Hedi Peterson, Dmytro Fishman Disclaimer We will be using the functions in the ggplot2

More information

Survey of Math: Excel Spreadsheet Guide (for Excel 2016) Page 1 of 9

Survey of Math: Excel Spreadsheet Guide (for Excel 2016) Page 1 of 9 Survey of Math: Excel Spreadsheet Guide (for Excel 2016) Page 1 of 9 Contents 1 Introduction to Using Excel Spreadsheets 2 1.1 A Serious Note About Data Security.................................... 2 1.2

More information

Basics of Plotting Data

Basics of Plotting Data Basics of Plotting Data Luke Chang Last Revised July 16, 2010 One of the strengths of R over other statistical analysis packages is its ability to easily render high quality graphs. R uses vector based

More information

Large data. Hadley Wickham. Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University.

Large data. Hadley Wickham. Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University. Large data Hadley Wickham Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University November 2010 1. The diamonds data 2. Histograms and bar charts 3. Frequency polygons

More information

Lecture 4: Data Visualization I

Lecture 4: Data Visualization I Lecture 4: Data Visualization I Data Science for Business Analytics Thibault Vatter Department of Statistics, Columbia University and HEC Lausanne, UNIL 11.03.2018 Outline 1 Overview

More information

The diamonds dataset Visualizing data in R with ggplot2

The diamonds dataset Visualizing data in R with ggplot2 Lecture 2 STATS/CME 195 Matteo Sesia Stanford University Spring 2018 Contents The diamonds dataset Visualizing data in R with ggplot2 The diamonds dataset The tibble package The tibble package is part

More information

Graphics - Part III: Basic Graphics Continued

Graphics - Part III: Basic Graphics Continued Graphics - Part III: Basic Graphics Continued Statistics 135 Autumn 2005 Copyright c 2005 by Mark E. Irwin Highway MPG 20 25 30 35 40 45 50 y^i e i = y i y^i 2000 2500 3000 3500 4000 Car Weight Copyright

More information

Animations involving numbers

Animations involving numbers 136 Chapter 8 Animations involving numbers 8.1 Model and view The examples of Chapter 6 all compute the next picture in the animation from the previous picture. This turns out to be a rather restrictive

More information

Configuring Figure Regions with prepplot Ulrike Grömping 03 April 2018

Configuring Figure Regions with prepplot Ulrike Grömping 03 April 2018 Configuring Figure Regions with prepplot Ulrike Grömping 3 April 218 Contents 1 Purpose and concept of package prepplot 1 2 Overview of possibilities 2 2.1 Scope.................................................

More information

Plotting with Rcell (Version 1.2-5)

Plotting with Rcell (Version 1.2-5) Plotting with Rcell (Version 1.2-) Alan Bush October 7, 13 1 Introduction Rcell uses the functions of the ggplots2 package to create the plots. This package created by Wickham implements the ideas of Wilkinson

More information

ggplot2 for beginners Maria Novosolov 1 December, 2014

ggplot2 for beginners Maria Novosolov 1 December, 2014 ggplot2 for beginners Maria Novosolov 1 December, 214 For this tutorial we will use the data of reproductive traits in lizards on different islands (found in the website) First thing is to set the working

More information

Importing and visualizing data in R. Day 3

Importing and visualizing data in R. Day 3 Importing and visualizing data in R Day 3 R data.frames Like pandas in python, R uses data frame (data.frame) object to support tabular data. These provide: Data input Row- and column-wise manipulation

More information

Package sciplot. February 15, 2013

Package sciplot. February 15, 2013 Package sciplot February 15, 2013 Version 1.1-0 Title Scientific Graphing Functions for Factorial Designs Author Manuel Morales , with code developed by the R Development Core Team

More information

Learning to use the drawing tools

Learning to use the drawing tools Create a blank slide This module was developed for Office 2000 and 2001, but although there are cosmetic changes in the appearance of some of the tools, the basic functionality is the same in Powerpoint

More information

Creating a Box-and-Whisker Graph in Excel: Step One: Step Two:

Creating a Box-and-Whisker Graph in Excel: Step One: Step Two: Creating a Box-and-Whisker Graph in Excel: It s not as simple as selecting Box and Whisker from the Chart Wizard. But if you ve made a few graphs in Excel before, it s not that complicated to convince

More information

Math Dr. Miller - Constructing in Sketchpad (tm) - Due via by Friday, Mar. 18, 2016

Math Dr. Miller - Constructing in Sketchpad (tm) - Due via  by Friday, Mar. 18, 2016 Math 304 - Dr. Miller - Constructing in Sketchpad (tm) - Due via email by Friday, Mar. 18, 2016 As with our second GSP activity for this course, you will email the assignment at the end of this tutorial

More information

Session 3 Nick Hathaway;

Session 3 Nick Hathaway; Session 3 Nick Hathaway; nicholas.hathaway@umassmed.edu Contents Manipulating Data frames and matrices 1 Converting to long vs wide formats.................................... 2 Manipulating data in table........................................

More information

Introduction to Graphics with ggplot2

Introduction to Graphics with ggplot2 Introduction to Graphics with ggplot2 Reaction 2017 Flavio Santi Sept. 6, 2017 Flavio Santi Introduction to Graphics with ggplot2 Sept. 6, 2017 1 / 28 Graphics with ggplot2 ggplot2 [... ] allows you to

More information

A set of rules describing how to compose a 'vocabulary' into permissible 'sentences'

A set of rules describing how to compose a 'vocabulary' into permissible 'sentences' Lecture 8: The grammar of graphics STAT598z: Intro. to computing for statistics Vinayak Rao Department of Statistics, Purdue University Grammar? A set of rules describing how to compose a 'vocabulary'

More information

Studying in the Sciences

Studying in the Sciences Organising data and creating figures (charts and graphs) in Excel What is in this guide Familiarisation with Excel (for beginners) Setting up data sheets Creating a chart (graph) Formatting the chart Creating

More information

Lastly, in case you don t already know this, and don t have Excel on your computers, you can get it for free through IT s website under software.

Lastly, in case you don t already know this, and don t have Excel on your computers, you can get it for free through IT s website under software. Welcome to Basic Excel, presented by STEM Gateway as part of the Essential Academic Skills Enhancement, or EASE, workshop series. Before we begin, I want to make sure we are clear that this is by no means

More information

Creating a Basic Chart in Excel 2007

Creating a Basic Chart in Excel 2007 Creating a Basic Chart in Excel 2007 A chart is a pictorial representation of the data you enter in a worksheet. Often, a chart can be a more descriptive way of representing your data. As a result, those

More information

AA BB CC DD EE. Introduction to Graphics in R

AA BB CC DD EE. Introduction to Graphics in R Introduction to Graphics in R Cori Mar 7/10/18 ### Reading in the data dat

More information

The following presentation is based on the ggplot2 tutotial written by Prof. Jennifer Bryan.

The following presentation is based on the ggplot2 tutotial written by Prof. Jennifer Bryan. Graphics Agenda Grammer of Graphics Using ggplot2 The following presentation is based on the ggplot2 tutotial written by Prof. Jennifer Bryan. ggplot2 (wiki) ggplot2 is a data visualization package Created

More information

Stat 849: Plotting responses and covariates

Stat 849: Plotting responses and covariates Stat 849: Plotting responses and covariates Douglas Bates 10-09-03 Outline Contents 1 R Graphics Systems Graphics systems in R ˆ R provides three dierent high-level graphics systems base graphics The system

More information

Homework 1 Excel Basics

Homework 1 Excel Basics Homework 1 Excel Basics Excel is a software program that is used to organize information, perform calculations, and create visual displays of the information. When you start up Excel, you will see the

More information

Week - 01 Lecture - 04 Downloading and installing Python

Week - 01 Lecture - 04 Downloading and installing Python Programming, Data Structures and Algorithms in Python Prof. Madhavan Mukund Department of Computer Science and Engineering Indian Institute of Technology, Madras Week - 01 Lecture - 04 Downloading and

More information

Rstudio GGPLOT2. Preparations. The first plot: Hello world! W2018 RENR690 Zihaohan Sang

Rstudio GGPLOT2. Preparations. The first plot: Hello world! W2018 RENR690 Zihaohan Sang Rstudio GGPLOT2 Preparations There are several different systems for creating data visualizations in R. We will introduce ggplot2, which is based on Leland Wilkinson s Grammar of Graphics. The learning

More information

Tips and Guidance for Analyzing Data. Executive Summary

Tips and Guidance for Analyzing Data. Executive Summary Tips and Guidance for Analyzing Data Executive Summary This document has information and suggestions about three things: 1) how to quickly do a preliminary analysis of time-series data; 2) key things to

More information

INTRODUCTION TO R. Basic Graphics

INTRODUCTION TO R. Basic Graphics INTRODUCTION TO R Basic Graphics Graphics in R Create plots with code Replication and modification easy Reproducibility! graphics package ggplot2, ggvis, lattice graphics package Many functions plot()

More information

ggplot2 basics Hadley Wickham Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University September 2011

ggplot2 basics Hadley Wickham Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University September 2011 ggplot2 basics Hadley Wickham Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University September 2011 1. Diving in: scatterplots & aesthetics 2. Facetting 3. Geoms

More information

6.001 Notes: Section 8.1

6.001 Notes: Section 8.1 6.001 Notes: Section 8.1 Slide 8.1.1 In this lecture we are going to introduce a new data type, specifically to deal with symbols. This may sound a bit odd, but if you step back, you may realize that everything

More information

6.001 Notes: Section 15.1

6.001 Notes: Section 15.1 6.001 Notes: Section 15.1 Slide 15.1.1 Our goal over the next few lectures is to build an interpreter, which in a very basic sense is the ultimate in programming, since doing so will allow us to define

More information

Charts in Excel 2003

Charts in Excel 2003 Charts in Excel 2003 Contents Introduction Charts in Excel 2003...1 Part 1: Generating a Basic Chart...1 Part 2: Adding Another Data Series...3 Part 3: Other Handy Options...5 Introduction Charts in Excel

More information

Introduction to R for Beginners, Level II. Jeon Lee Bio-Informatics Core Facility (BICF), UTSW

Introduction to R for Beginners, Level II. Jeon Lee Bio-Informatics Core Facility (BICF), UTSW Introduction to R for Beginners, Level II Jeon Lee Bio-Informatics Core Facility (BICF), UTSW Basics of R Powerful programming language and environment for statistical computing Useful for very basic analysis

More information

Data Visualization Using R & ggplot2. Karthik Ram October 6, 2013

Data Visualization Using R & ggplot2. Karthik Ram October 6, 2013 Data Visualization Using R & ggplot2 Karthik Ram October 6, 2013 Some housekeeping Install some packages install.packages("ggplot2", dependencies = TRUE) install.packages("plyr") install.packages("ggthemes")

More information

Excel Basics Fall 2016

Excel Basics Fall 2016 If you have never worked with Excel, it can be a little confusing at first. When you open Excel, you are faced with various toolbars and menus and a big, empty grid. So what do you do with it? The great

More information

Part II: Creating Visio Drawings

Part II: Creating Visio Drawings 128 Part II: Creating Visio Drawings Figure 5-3: Use any of five alignment styles where appropriate. Figure 5-4: Vertical alignment places your text at the top, bottom, or middle of a text block. You could

More information

Software Compare and Contrast

Software Compare and Contrast Microsoft Software Compare and Contrast Word Easy to navigate. Compatible with all PC computers. Very versatile. There are lots of templates that can be used to create flyers, calendars, resumes, etc.

More information

Econ 2148, spring 2019 Data visualization

Econ 2148, spring 2019 Data visualization Econ 2148, spring 2019 Maximilian Kasy Department of Economics, Harvard University 1 / 43 Agenda One way to think about statistics: Mapping data-sets into numerical summaries that are interpretable by

More information

DSCI 325: Handout 18 Introduction to Graphics in R

DSCI 325: Handout 18 Introduction to Graphics in R DSCI 325: Handout 18 Introduction to Graphics in R Spring 2016 This handout will provide an introduction to creating graphics in R. One big advantage that R has over SAS (and over several other statistical

More information

EXST 7014, Lab 1: Review of R Programming Basics and Simple Linear Regression

EXST 7014, Lab 1: Review of R Programming Basics and Simple Linear Regression EXST 7014, Lab 1: Review of R Programming Basics and Simple Linear Regression OBJECTIVES 1. Prepare a scatter plot of the dependent variable on the independent variable 2. Do a simple linear regression

More information

Getting started with simulating data in R: some helpful functions and how to use them Ariel Muldoon August 28, 2018

Getting started with simulating data in R: some helpful functions and how to use them Ariel Muldoon August 28, 2018 Getting started with simulating data in R: some helpful functions and how to use them Ariel Muldoon August 28, 2018 Contents Overview 2 Generating random numbers 2 rnorm() to generate random numbers from

More information

Depending on the computer you find yourself in front of, here s what you ll need to do to open SPSS.

Depending on the computer you find yourself in front of, here s what you ll need to do to open SPSS. 1 SPSS 11.5 for Windows Introductory Assignment Material covered: Opening an existing SPSS data file, creating new data files, generating frequency distributions and descriptive statistics, obtaining printouts

More information

HOW TO. In this section, you will find. miscellaneous handouts that explain. HOW TO do various things.

HOW TO. In this section, you will find. miscellaneous handouts that explain. HOW TO do various things. In this section, you will find miscellaneous handouts that explain do various things. 140 SAVING Introduction Every time you do something, you should save it on the DESKTOP. Click Save and then click on

More information

Rockefeller College MPA Excel Workshop: Clinton Impeachment Data Example

Rockefeller College MPA Excel Workshop: Clinton Impeachment Data Example Rockefeller College MPA Excel Workshop: Clinton Impeachment Data Example This exercise is a follow-up to the MPA admissions example used in the Excel Workshop. This document contains detailed solutions

More information

Chapter 1: Introduction to the Microsoft Excel Spreadsheet

Chapter 1: Introduction to the Microsoft Excel Spreadsheet Chapter 1: Introduction to the Microsoft Excel Spreadsheet Objectives This chapter introduces you to the Microsoft Excel spreadsheet. You should gain an understanding of the following topics: The range

More information

data visualization Show the Data Snow Month skimming deep waters

data visualization Show the Data Snow Month skimming deep waters data visualization skimming deep waters Show the Data Snow 2 4 6 8 12 Minimize Distraction Minimize Distraction Snow 2 4 6 8 12 2 4 6 8 12 Make Big Data Coherent Reveal Several Levels of Detail 1974 1975

More information

An introduction to plotting data

An introduction to plotting data An introduction to plotting data Eric D. Black California Institute of Technology February 25, 2014 1 Introduction Plotting data is one of the essential skills every scientist must have. We use it on a

More information

Decimals should be spoken digit by digit eg 0.34 is Zero (or nought) point three four (NOT thirty four).

Decimals should be spoken digit by digit eg 0.34 is Zero (or nought) point three four (NOT thirty four). Numeracy Essentials Section 1 Number Skills Reading and writing numbers All numbers should be written correctly. Most pupils are able to read, write and say numbers up to a thousand, but often have difficulty

More information

Exploring Fractals through Geometry and Algebra. Kelly Deckelman Ben Eggleston Laura Mckenzie Patricia Parker-Davis Deanna Voss

Exploring Fractals through Geometry and Algebra. Kelly Deckelman Ben Eggleston Laura Mckenzie Patricia Parker-Davis Deanna Voss Exploring Fractals through Geometry and Algebra Kelly Deckelman Ben Eggleston Laura Mckenzie Patricia Parker-Davis Deanna Voss Learning Objective and skills practiced Students will: Learn the three criteria

More information

Lab5A - Intro to GGPLOT2 Z.Sang Sept 24, 2018

Lab5A - Intro to GGPLOT2 Z.Sang Sept 24, 2018 LabA - Intro to GGPLOT2 Z.Sang Sept 24, 218 In this lab you will learn to visualize raw data by plotting exploratory graphics with ggplot2 package. Unlike final graphs for publication or thesis, exploratory

More information

A Step-by-step guide to creating a Professional PowerPoint Presentation

A Step-by-step guide to creating a Professional PowerPoint Presentation Quick introduction to Microsoft PowerPoint A Step-by-step guide to creating a Professional PowerPoint Presentation Created by Cruse Control creative services Tel +44 (0) 1923 842 295 training@crusecontrol.com

More information

Exercise 1: Introduction to MapInfo

Exercise 1: Introduction to MapInfo Geog 578 Exercise 1: Introduction to MapInfo Page: 1/22 Geog 578: GIS Applications Exercise 1: Introduction to MapInfo Assigned on January 25 th, 2006 Due on February 1 st, 2006 Total Points: 10 0. Convention

More information

To make sense of data, you can start by answering the following questions:

To make sense of data, you can start by answering the following questions: Taken from the Introductory Biology 1, 181 lab manual, Biological Sciences, Copyright NCSU (with appreciation to Dr. Miriam Ferzli--author of this appendix of the lab manual). Appendix : Understanding

More information

Adobe InDesign CS6 Tutorial

Adobe InDesign CS6 Tutorial Adobe InDesign CS6 Tutorial Adobe InDesign CS6 is a page-layout software that takes print publishing and page design beyond current boundaries. InDesign is a desktop publishing program that incorporates

More information

ENV Laboratory 2: Graphing

ENV Laboratory 2: Graphing Name: Date: Introduction It is often said that a picture is worth 1,000 words, or for scientists we might rephrase it to say that a graph is worth 1,000 words. Graphs are most often used to express data

More information

Matrices. Chapter Matrix A Mathematical Definition Matrix Dimensions and Notation

Matrices. Chapter Matrix A Mathematical Definition Matrix Dimensions and Notation Chapter 7 Introduction to Matrices This chapter introduces the theory and application of matrices. It is divided into two main sections. Section 7.1 discusses some of the basic properties and operations

More information

Note that ALL of these points are Intercepts(along an axis), something you should see often in later work.

Note that ALL of these points are Intercepts(along an axis), something you should see often in later work. SECTION 1.1: Plotting Coordinate Points on the X-Y Graph This should be a review subject, as it was covered in the prerequisite coursework. But as a reminder, and for practice, plot each of the following

More information

Intro To Excel Spreadsheet for use in Introductory Sciences

Intro To Excel Spreadsheet for use in Introductory Sciences INTRO TO EXCEL SPREADSHEET (World Population) Objectives: Become familiar with the Excel spreadsheet environment. (Parts 1-5) Learn to create and save a worksheet. (Part 1) Perform simple calculations,

More information

Box It Up (A Graphical Look)

Box It Up (A Graphical Look) . Name Date A c t i v i t y 1 0 Box It Up (A Graphical Look) The Problem Ms. Hawkins, the physical sciences teacher at Hinthe Middle School, needs several open-topped boxes for storing laboratory materials.

More information

A. Using the data provided above, calculate the sampling variance and standard error for S for each week s data.

A. Using the data provided above, calculate the sampling variance and standard error for S for each week s data. WILD 502 Lab 1 Estimating Survival when Animal Fates are Known Today s lab will give you hands-on experience with estimating survival rates using logistic regression to estimate the parameters in a variety

More information

8. MINITAB COMMANDS WEEK-BY-WEEK

8. MINITAB COMMANDS WEEK-BY-WEEK 8. MINITAB COMMANDS WEEK-BY-WEEK In this section of the Study Guide, we give brief information about the Minitab commands that are needed to apply the statistical methods in each week s study. They are

More information

S4C03, HW2: model formulas, contrasts, ggplot2, and basic GLMs

S4C03, HW2: model formulas, contrasts, ggplot2, and basic GLMs S4C03, HW2: model formulas, contrasts, ggplot2, and basic GLMs Ben Bolker September 23, 2013 Licensed under the Creative Commons attribution-noncommercial license (http://creativecommons.org/licenses/by-nc/3.0/).

More information

Module 10. Data Visualization. Andrew Jaffe Instructor

Module 10. Data Visualization. Andrew Jaffe Instructor Module 10 Data Visualization Andrew Jaffe Instructor Basic Plots We covered some basic plots on Wednesday, but we are going to expand the ability to customize these basic graphics first. 2/37 But first...

More information

Excel Tips and FAQs - MS 2010

Excel Tips and FAQs - MS 2010 BIOL 211D Excel Tips and FAQs - MS 2010 Remember to save frequently! Part I. Managing and Summarizing Data NOTE IN EXCEL 2010, THERE ARE A NUMBER OF WAYS TO DO THE CORRECT THING! FAQ1: How do I sort my

More information

PyPlot. The plotting library must be imported, and we will assume in these examples an import statement similar to those for numpy and math as

PyPlot. The plotting library must be imported, and we will assume in these examples an import statement similar to those for numpy and math as Geog 271 Geographic Data Analysis Fall 2017 PyPlot Graphicscanbeproducedin Pythonviaavarietyofpackages. We willuseapythonplotting package that is part of MatPlotLib, for which documentation can be found

More information

On the Web sun.com/aboutsun/comm_invest STAROFFICE 8 DRAW

On the Web sun.com/aboutsun/comm_invest STAROFFICE 8 DRAW STAROFFICE 8 DRAW Graphics They say a picture is worth a thousand words. Pictures are often used along with our words for good reason. They help communicate our thoughts. They give extra information that

More information

Correlation. January 12, 2019

Correlation. January 12, 2019 Correlation January 12, 2019 Contents Correlations The Scattterplot The Pearson correlation The computational raw-score formula Survey data Fun facts about r Sensitivity to outliers Spearman rank-order

More information

Your Name: Section: INTRODUCTION TO STATISTICAL REASONING Computer Lab #4 Scatterplots and Regression

Your Name: Section: INTRODUCTION TO STATISTICAL REASONING Computer Lab #4 Scatterplots and Regression Your Name: Section: 36-201 INTRODUCTION TO STATISTICAL REASONING Computer Lab #4 Scatterplots and Regression Objectives: 1. To learn how to interpret scatterplots. Specifically you will investigate, using

More information

Lab #9: ANOVA and TUKEY tests

Lab #9: ANOVA and TUKEY tests Lab #9: ANOVA and TUKEY tests Objectives: 1. Column manipulation in SAS 2. Analysis of variance 3. Tukey test 4. Least Significant Difference test 5. Analysis of variance with PROC GLM 6. Levene test for

More information

MS Office Word Tabs & Tables Manual. Catraining.co.uk Tel:

MS Office Word Tabs & Tables Manual. Catraining.co.uk Tel: MS Office 2010 Word Tabs & Tables Manual Catraining.co.uk Tel: 020 7920 9500 Table of Contents TABS... 1 BASIC TABS WITH ALIGNMENT... 1 DEFAULT TAB STOP... 1 SET MANUAL TAB STOPS WITH RULER... 2 SET MANUAL

More information

In our first lecture on sets and set theory, we introduced a bunch of new symbols and terminology.

In our first lecture on sets and set theory, we introduced a bunch of new symbols and terminology. Guide to and Hi everybody! In our first lecture on sets and set theory, we introduced a bunch of new symbols and terminology. This guide focuses on two of those symbols: and. These symbols represent concepts

More information

Heuristic Evaluation of Covalence

Heuristic Evaluation of Covalence Heuristic Evaluation of Covalence Evaluator #A: Selina Her Evaluator #B: Ben-han Sung Evaluator #C: Giordano Jacuzzi 1. Problem Covalence is a concept-mapping tool that links images, text, and ideas to

More information

How to Make Graphs with Excel 2007

How to Make Graphs with Excel 2007 Appendix A How to Make Graphs with Excel 2007 A.1 Introduction This is a quick-and-dirty tutorial to teach you the basics of graph creation and formatting in Microsoft Excel. Many of the tasks that you

More information

SAMLab Tip Sheet #4 Creating a Histogram

SAMLab Tip Sheet #4 Creating a Histogram Creating a Histogram Another great feature of Excel is its ability to visually display data. This Tip Sheet demonstrates how to create a histogram and provides a general overview of how to create graphs,

More information

Plotting Complex Figures Using R. Simon Andrews v

Plotting Complex Figures Using R. Simon Andrews v Plotting Complex Figures Using R Simon Andrews simon.andrews@babraham.ac.uk v2017-11 The R Painters Model Plot area Base plot Overlays Core Graph Types Local options to change a specific plot Global options

More information

ENVIRONMENTALLY RESPONSIBLE PRINTING ARTWORK GUIDE BOOK ALL YOU NEED TO KNOW ABOUT CREATING ARTWORK FOR PRINT TOGETHER.

ENVIRONMENTALLY RESPONSIBLE PRINTING ARTWORK GUIDE BOOK ALL YOU NEED TO KNOW ABOUT CREATING ARTWORK FOR PRINT TOGETHER. ENVIRONMENTALLY RESPONSIBLE PRINTING ARTWORK GUIDE BOOK ALL YOU NEED TO KNOW ABOUT CREATING ARTWORK FOR PRINT TOGETHER. contents pg3. Choose a Design application pg4. Artwork requirements pg5. Creating

More information

Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 24 Solid Modelling

Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 24 Solid Modelling Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 24 Solid Modelling Welcome to the lectures on computer graphics. We have

More information