# Posts Tagged ‘ plot ’

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

October 9, 2012
By 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...

## Functions for plotting and getting Greek in labels

October 8, 2012
By 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...

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

August 2, 2012
By 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 class is representing a water

## Plotting 95% Confidence Bands in R

July 26, 2012
By 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
By 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

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

July 10, 2012
By 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 will need several plots in

## Timeline graph with ggplot2

July 7, 2012
By 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 will be  Read more »The post Timeline graph with ggplot2 appeared...

## Tutorial: Using plot() function

April 19, 2012
By 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
By 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 on FastRWeb, you

## Example 9.23: Demonstrating proportional hazards

March 13, 2012
By 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...