How to combine 4 pairs of sections in one figure?

in advance, sorry if I bother you with trivial questions.

I had to make 1 drawing, which contains 4 different mutually conjugate graphs. The view of the desired graph can be seen as follows: enter image description here

Every single stroke I make with pairs of functions ():

pairs(cbind(AAPL,MSFT,INTC,FB,MU,IBM),main="Frequency=1 Min.",font.labels = 2, col="blue",pch=16, cex=0.8, cex.axis=1.5,las=1) pairs(cbind(AAPL,MSFT,INTC,FB,MU,IBM),main="Frequency = 2 Min.",font.labels = 2, col="blue",pch=16, cex=0.8, cex.axis=1.5,las=1) pairs(cbind(AAPL,MSFT,INTC,FB,MU,IBM),main="Frequency = 5 Min.",font.labels = 2, col="blue",pch=16, cex=0.8, cex.axis=1.5,las=1) pairs(cbind(AAPL,MSFT,INTC,FB,MU,IBM),main="Frequency = 10 Min.",font.labels = 2, col="blue",pch=16, cex=0.8, cex.axis=1.5,las=1) 

When I combine over paired graphs through the use of the layout function, it does not work (as far as I understood from similar questions layout () and pairs () cannot be combined).

If someone has an elegant way to combine 4 different correlation correlation graphs, help will be greatly appreciated.

+6
source share
3 answers

Update, 12014-07-31 11: 48: 35Z

As ilir pointed out below, pairs somehow rewrites par , most likely for some good reason.

@ user44037, can you solve your problem by working with this piece of code? Copy / paste from here . I believe that a solution can be found using splom from lattice . take a look at ?splom .

  library(lattice) splom(~iris[1:3]|Species, data = iris, layout=c(2,2), pscales = 0, varnames = c("Sepal\nLength", "Sepal\nWidth", "Petal\nLength"), page = function(...) { ltext(x = seq(.6, .8, len = 4), y = seq(.9, .6, len = 4), lab = c("@user44037,", "can you solve your", "problem working form ", "this code snippet?"), cex = 1) }) 

enter image description here

Initial Answer, 12014-07-31 11: 35: 33Z

Just follow the Avinash directions by copying / pasting the code from the Quick-R website . Feel free to improve this example.

I am happy to fix your specific problem if you provide a reproducible example.

 # 4 figures arranged in 2 rows and 2 columns attach(mtcars) par(mfrow=c(2,2)) plot(wt,mpg, main="Scatterplot of wt vs. mpg") plot(wt,disp, main="Scatterplot of wt vs disp") hist(wt, main="Histogram of wt") boxplot(wt, main="Boxplot of wt") 

enter image description here

0
source

The problem is solved using the splom () function as Eric Fail :

The solution can be found here .

+1
source

The answer to this question may help: Create a matrix of scatterplots (pair equivalents ()) in ggplot2

You can create paired graphs using ggpairs in the GGgalley package. Since they must be ggplot objects, you can organize them using grid.arrange in the gridExtra package.

0
source

Source: https://habr.com/ru/post/973156/


All Articles