Home > Software engineering >  scatterplotMatrix with diagonal histogram
scatterplotMatrix with diagonal histogram

Time:10-20

I'm trying to create a scatterplotMatrix for my data, then i tried the code taken from https://livebook.manning.com/book/r-in-action/chapter-11/46

  scatterplotMatrix(~ mpg   disp   drat   wt | cyl, data=mtcars,
                  spread=FALSE, diagonal="histogram",
                  main="Scatter Plot Matrix via car Package")

then i run it

enter image description here

the results are different, and no histogram appears in the plot

and a warning appears

There were 50 or more warnings (use warnings() to see the first 50)

can you tell me where is the problem and how to fix it?

CodePudding user response:

You should mention the method in a list to diagonal like this:

library(car)
#> Loading required package: carData
scatterplotMatrix(~ mpg   disp   drat   wt | cyl, data=mtcars,
                  spread=FALSE, diagonal=list(method ="histogram"),
                  main="Scatter Plot Matrix via car Package")

Created on 2022-10-19 with reprex v2.0.2

  • Related