Archiv der Kategorie: R

Data visualization in R: Boxplot

The box plot is a graphical representation showing the median, quartiles and the smallest and largest values of a data set. It will show a visual shape of the data distribution. The following example shows a simple boxplot of the … Weiterlesen

Veröffentlicht unter R | Kommentar hinterlassen

Data visualization in R: Pie charts

Before we start to look at the features and functions of pie charts let me introduce some thoughts about the benefits and cons of this chart type. You will find a lot of discussions about this topic. Summary of these … Weiterlesen

Veröffentlicht unter R | Kommentar hinterlassen

Data visualization in R: Clustered and stacked bar plot

A bar plot can be used to show data in a cluster or stacked by category. Within this article I want to show you both cases.   Clustered bar plot By default a bar plot is clustered. The following example … Weiterlesen

Veröffentlicht unter R | Kommentar hinterlassen

Data visualization in R: Histogram

A histogram shows vertical bars representing the frequency distribution of a quantitative variable. Histograms are a great way to get to know your data. They allow you to easily see where a large and a little amount of the data … Weiterlesen

Veröffentlicht unter R | Kommentar hinterlassen

Data visualization in R: Add smooth curve and shaded area to a plot

Within this article I want to show you an easy way to add a smooth curve to your plot, create an area around this curve and fill the area with a transparent color. Let’s start with a standard plot. x … Weiterlesen

Veröffentlicht unter R | Kommentar hinterlassen

Data visualization in R: Change the aspect ratio for a plot

To create a meaningful plot or if you want to save your plot as image you may want to define a fix aspect ratio. The plot function itself offers the possibility to define an own aspect ratio by setting the … Weiterlesen

Veröffentlicht unter R | Kommentar hinterlassen

Data visualization in R: Plotting a function

With the function curve you may plot a function. The following example shows how to use this function.   curve(x^3, from = -10 , to = 10, main = ‚f(x)=x^3‘, lwd = 2) The curve function offers the option add … Weiterlesen

Veröffentlicht unter R | Kommentar hinterlassen

Data visualization in R: Overlaying plots with matplot

With matplot you can plot the columns of matrices. So it will allow you to draw several data sets at the same time and creates a graph by overlaying the different plots. For example we have three different measurement values … Weiterlesen

Veröffentlicht unter R | Kommentar hinterlassen

Data visualization in R: Background color

You can choose the background of your plot by using the command par(bg=). x <- c(1,2,3,4,5,6) y <- c(3,6,9,4,3,4) par(bg=’lightgreen‘) plot(x,y, type = ‚l‘) As you can see, the command par(bg=) sets the color of the whole plotting area. If … Weiterlesen

Veröffentlicht unter R | Kommentar hinterlassen

Data visualization in R: Grid

By using the grid method you may add a grid to the current graph. By default the grid lines will align with the tick marks on the corresponding default axis. Although by using the arguments nx and ny you may … Weiterlesen

Veröffentlicht unter R | Kommentar hinterlassen