# plot

### Conditional Colors and Shapes in plot() with ifelse()

October 9, 2012 |

Here’s an example of how to color your plot shapes and pch using an ifelse() statement. Ifelse() is handy as it creates an easy way to branch a function. The syntax is: ifelse(logical.condition, option1, option2). Meaning, if the logical condi... [Read more...]

### Functions for plotting and getting Greek in labels

October 8, 2012 |

The problem: We often want to plot data and assign plot attributes based on characteristics of the data. For example, if we have a group of students with the following IQs, we might want to indicate who is an outlier in the statistical sense. I like... [Read more...]

### plotting raster data in R: adjusting the labels and colors of a classified raster

August 2, 2012 |

Thank’s to Andrej who wrote this comment: “Is it possible to to color the resulting 12 clusters within your original image to get a feel for visual separation?” You can do so: But how to get values at a location? You will need these values to determine whether the defined ... [Read more...]

### Plotting 95% Confidence Bands in R

July 26, 2012 |

I am comparing estimates from subject-specific GLMMs and population-average GEE models as part of a publication I am working on. As part of this, I want to visualize predictions of each type of model including 95% confidence bands. First I had to ma...

### Holt-Winters forecast using ggplot2

July 16, 2012 |

R has great support for Holt-Winter filtering and forecasting. I sometimes use this functionality, HoltWinter & predict.HoltWinter, to forecast demand figures based on historical data. Using the HoltWinter functions in R is pretty straightforward. Let's say our dataset looks as follows; demand [Read more...]

### introduction to R: learning by doing (part 2: plots)

July 10, 2012 |

Lets go one with the second part of learning R by doing R (you will find the first part here. As we have used vectors, matrices and loops in the first part, we will concentrate on graphics in this one. but first we will need data to plot: Sometimes you ... [Read more...]

### Timeline graph with ggplot2

July 7, 2012 |

This post shows how to create a timeline graph by using ggplot2. Let’s start by loading the ggplot2 library. Next let’s create a dataset which we will use to feed the graph. In the last column (y), I create random positive values for the first three rows (which ... [Read more...]

### Tutorial: Using plot() function

April 19, 2012 |

Hello Readers! This is my first post as a member ofR-bloggers. In this post I'm going to talk about the basic plotting in R, fortwo dimensional. This is a tutorial for beginners in R.To begin with, let's define a vector first. Say wehave vector x, whic...

### How to plot lattice and ggplot2 graphs with FastRWeb

April 10, 2012 |

With print() If you are an advanced R user, you probably know the lattice and the ggplot2 packages. They allow you to plot elegant graphics with less code (Hocking, 2009 and Sueur, 2010). If you know these two packages, you should hardly use plot() for your graphs. If you read my article ... [Read more...]

### Example 9.23: Demonstrating proportional hazards

March 13, 2012 |

A colleague recently asked after a slide suitable for explaining proportional hazards. In particular, she was concerned that her audience not focus on the time to event or probability of the event. An initial thought was to display the cumulative haz...

### Plotting grouped data vs time with error bars in R

October 31, 2011 |

This is my first blog since joiningR-bloggers. I’m quite excited to be part of this group and apologize if I boreany experienced R users with my basic blogs for learning R or offendprogrammers with my inefficient, sloppy coding. Hopefully writing for...

### Simple plot using R

September 21, 2011 |

As a task for my Financial eco assignment I had to plot a simple time series of the overnight MIBOR(Mumbai interbank offer rates) for the past one year . The job could very well have been done easily in MS-Excel but I choose to plot it in R instea...

### Scatter plots with images

September 4, 2011 |

Edward Tufte has written extensively on the presentation of data covering good and bad practice. He has made a number of suggestions for adaptations of regularly used graph types to assist with the interpretation and understanding of data. One idea for enhancing scatter plots covered in Tufte’s book Beautiful ... [Read more...]

### "My interpretation of [Leland Wilkinson’s] grammar [of statistical graphics]: —Data is the most…"

August 25, 2011 |

“My interpretation of [Leland Wilkinson’s] grammar [of statistical graphics]: —Data is the most important thing, and the thing that you bring to the table. —Geometric objects … what you actually see on the plot: points, lines, polygons, etc. ... [Read more...]

### "My interpretation of [Leland Wilkinson’s] grammar [of statistical graphics]: —Data is the most…"

August 25, 2011 |

“My interpretation of [Leland Wilkinson’s] grammar [of statistical graphics]: —Data is the most important thing, and the thing that you bring to the table. —Geometric objects … what you actually see on the plot: points, lines, polygons, etc. ... [Read more...]

### ggplot2 Version of Figures in “25 Recipes for Getting Started with R”

August 16, 2011 |

In order to provide an option to compare graphs produced by basic internal plot function and ggplot2, I recreated the figures in the book, 25 Recipes for Getting Started with R, with ggplot2. The code used to create the images is in separate paragraphs, allowing easy comparison. Read More: 336 Words Totally [Read more...]

### the batman equation

August 13, 2011 |

HardOCP has an image with an equation which apparently draws the Batman logo. Read More: 1295 Words Totally [Read more...]

### Plotting Cumulative FII & DII Inflow against Nifty spot index

August 10, 2011 |

Now that I have the FII and DII Inflow along with Nifty Index, I tried my hands on charting!The objective is to plot the Cumulative FII, DII and Net Inflow and Nifty Index for current year (2011) on a single graph. This post takes inspiration from Deep... [Read more...]

### Fixed: Unable to plot a decent x-Axis in a time series plot using zoo

June 16, 2011 |

Here is the link to the original problem. Briefly, I was unable to plot a custom x-axis showing abbreviated months in a time series plot of a zoo object. In the plot.zoo() function set xaxt = "n" to suppress plotting … Continue reading → [Read more...]

### Boxplots without boxes

June 14, 2011 |

Let’s say you have several categories with multiple data points each that you would like to plot as individual points. Even if you have only a single point, the R graphics package will plot a line (without a box for … Continue reading → [Read more...]
1 2 3