in R Language by
Bivariate analysis with ggpair with partial grouping in R Language

▼ Show 1 Answer

0 votes

The graph below is a little bit different. We change the position of the mapping inside the upper argument.

ggpairs(data, columns = c("log_totexp", "log_income", "age", "wtrans"),
    title = "Bivariate analysis of revenue expenditure by the British household",
    upper = list(continuous = wrap("cor",
            size = 3),
        mapping = aes(color = children_fac)),
    lower = list(
        continuous = wrap("smooth",
            alpha = 0.3,
            size = 0.1))

Code Explanation

  • Exact same code as previous example except for:
  • mapping = aes(color = children_fac): Move the list in upper = list(). We only want the computation stacked by group in the upper part of the graph
Learn More with Madanswer

Related questions

0 votes
asked Nov 14, 2019 in R Language by MBarbieri