How to create a plot with two or more side-by-side histograms:

-1

I need to plot these two histograms side by side.

hist(DEM)
hist(Tdem)

I can only plot individually.

    
asked by anonymous 20.09.2018 / 23:48

1 answer

3

There are two ways of doing the same thing, considering only the native R

Consider the dataset iris as an example, the two scrits below will produce the same result.

The command c(1,2) of both means 1 row and 2 columns, ie the two parallel figures.

par(mfrow=c(1,2))

hist(iris$Sepal.Length)
hist(iris$Petal.Length)
par(mfrow=c(1,1))


split.screen(figs=c(1,2))

screen(1)
hist(iris$Sepal.Length)
screen(2)
hist(iris$Petal.Length)
close.screen(all=TRUE)

    
21.09.2018 / 00:45