Archiv der Kategorie: R

Data visualization in R: Boxes

Each plot is framed by a box. The bty parameter will allow you to define the box type. The following values are supported and define the borders of the box. The appearance of the character reflects the borders to be … Weiterlesen

Veröffentlicht unter R | Kommentar hinterlassen

Data visualization in R: Horizontal and vertical lines

You may add additional horizontal and vertical lines to a plot by using the abline function. This will allow you to create a customized grid or to show one or several important points or limits within you plot. The following … Weiterlesen

Veröffentlicht unter R | 1 Kommentar

Data visualization in R: Line style

The styles of lines within a plot may be easily changed by defining a line style and a line width. The plot function provides according arguments. By using the lty argument you may set the line type. The argument accepts … Weiterlesen

Veröffentlicht unter R | Kommentar hinterlassen

Data visualization in R: Point symbols

For points the symbols can be changed using the pch argument. The following example shows a simple plot with a colored square symbol for the points. x <- c(1,2,3,4,5,6) y <- c(3,6,9,4,3,4) plot(x, y, pch=22, type=’b‘, ylim=c(1,10), col=’blue‘, bg=’red‘) In … Weiterlesen

Werbung

Veröffentlicht unter R | Kommentar hinterlassen

Data visualization in R: Colors of titles, axes, points and lines

The colors of the plot elements can be changed by using the col argument. You may use this argument in the according commands, e.g. in the axis command, or you may use it in the plot command and specify the … Weiterlesen

Veröffentlicht unter R | Kommentar hinterlassen

Data visualization in R: Margins

You may set margins of a plot to adapt its visualization. This could be necessary if you want to change the labeling of a plot, e.g. by adding a legend, additional labels or change the style of axes. Or you … Weiterlesen

Veröffentlicht unter R | Kommentar hinterlassen

Data visualization in R: Show legend outside of the plotting area

If you add a legend to a plot, it will be placed inside the plotting area by default. The following example creates a stacked bar plot with the sales data of books, magazines and newspapers. In such type of plots … Weiterlesen

Veröffentlicht unter R | Kommentar hinterlassen

Data visualization in R: Legend

If you show different data sets in one plot it becomes necessary to label these data sets. This is normally done by adding a legend. So let’s have a look at an example. The following code creates a plot to … Weiterlesen

Veröffentlicht unter R | Kommentar hinterlassen

Data visualization in R: Axis tick marks

You can use the axis function to customize the tick marks of your plot. The parameter of this function will allow you to define the tick values, their labels and the drawing direction and size of the tick marks. Let … Weiterlesen

Veröffentlicht unter R | Kommentar hinterlassen

Data visualization in R: Two different x-axes

It is possible to create two different axes for x values. So you may show two different data sets within one plot. In this article we want to implement an example plot to show a weather forecast which contains the … Weiterlesen

Veröffentlicht unter R | Kommentar hinterlassen