background preloader

Producing Simple Graphs with R

Producing Simple Graphs with R

R graphics plot gallery - plots, charts and graphs with R code R has great graphics and plotting capabilities and can produce a wide range of plots very easily. The following is an R plot gallery with a selection of different R plot types and graphs that were all generated with R. In each case you can click on the graph to see the commented code that produced the plot in R. This shows the spatial distribution of galaxies in the cluster Abell 85, using data from the NASA Extragalactic Database (NED). To follow a step-by-step tutorial showing how to create a similar plot in R, click here. There is now a Birmingham (UK) R user group: click here for more information An R chart of daily weather measurements taken at the University of Birmingham Wast Hill Observatory, using the excellent R lattice graphics package. Using ggplot2 to show mean temperature profiles and their error envelopes for cool-core and non-cool core clusters, from Sanderson et al. (2006). A plot of some blackbody curves for 3 different temperatures.

Les templates en C++ Introduction Nous allons présenter la notion de template (patron en français). Les templates font parties des grands apports du C++ au langage C. Jusqu'ici on passait en paramètre des fonctions des variables. Avantages On appelle dans ce qui suit symbole indifféremment une fonction, une structure ou une classe. Inconvénients - Comme nous allons le voir par la suite, l'utilisation de template requiert quelques précautions d'usage (typename...) - Le programme est plus long à compiler. Quand utiliser des templates ? L'usage des templates est particulièrement pertinent pour définir des containers, c'est-à-dire des structures qui servent à stocker une collection d'objets (une liste, un vecteur, un graphe...). Les templates sont également adaptés pour définir des algorithmes génériques s'appliquant à une famille de classe. Que dois-je mettre dans les .hpp et dans les .cpp ? Le C++ étant un langage compilé, on ne peut évidemment pas imaginer de compiler pour un symbole donné toutes ses versions.

Announcing RPubs: A New Web Publishing Service for R « RStudio Blog Today we’re very excited to announce RPubs, a free service that makes it easy to publish documents to the web from R. RPubs is a quick and easy way to disseminate data analysis and R code and do ad-hoc collaboration with peers. RPubs documents are based on R Markdown, a new feature of knitr 0.5 and RStudio 0.96. RPubs documents include a moderated comment stream for feedback and dialog with readers, and can be updated with changes by publishing again from within RStudio. Note that you’ll only see the Publish button if you update to the latest version of RStudio (v0.96.230, available for download today). The markdown package RStudio has integrated support for working with R Markdown and publishing to RPubs, but we also want to make sure that no matter what tools you use it’s still possible to get the same results. The markdown package provides a standalone implementation of R Markdown rendering that can be integrated with other editors and IDEs. Gallery of examples Like this: Like Loading...

Data Analysis in the Geosciences 22 January, 2013 Many things are easy in R are simple, but sometimes the solution is not obvious. Adding error bars to a bar plot is one of those things. The segments() command lets you draw line segments, provided you specify the coordinates of the beginning and end of the segments. You could use the locator() function to find the centers of the bars, but clicking on points can be imprecise. Here is how it all works. names <- c("squirrel", "rabbit", "chipmunk") means <- c(23, 28, 19) standardErrors <- c(1.2, 1.7, 0.9) Because the top of the plot is scaled to the tallest bar, the error bars will get clipped if I add them. plotTop <- max(means+standardErrors*2) First, I will plot the graph, with the bars filled with gray, with y-axis labels rotated (las=1), and with the limits on the y-axis expanded so they will include the error bars. barCenters <- barplot(means, names.arg=names, col="gray", las=1, ylim=c(0,plotTop)) Pretty straightforward!