Skip to content

Inconsistent y-axis labeling for diagonal density plots in ggpairs() #555

@Liu499-create

Description

@Liu499-create

Issue Description:
When using ggpairs() with density plots on the diagonal, only the first variable's density plot shows proper density scale on the y-axis, while other variables display their raw value ranges instead of density values. This appears inconsistent with the expected behavior.

Reproducible Example:

library(GGally)
library(ggplot2)

data("mtcars", package = "datasets")
mtcars_subset = subset(mtcars, select = c("mpg", "cyl", "disp"))

ggpairs(
mtcars_subset,
axisLabels = "show",
diag = list(continuous = wrap("densityDiag"))
)

Observed Behavior:

  1. For mpg (first variable):
  • Left y-axis shows density values (0.00 to 0.06)
  • Bottom x-axis shows mpg values (10 to 35)
  1. For cyl and disp:
  • Left y-axis shows variable ranges (4-8 for cyl, 100-400 for disp)
  • No visible density scale
  • Bottom x-axis shows respective variable values

Expected Behavior:
All diagonal density plots should:

  • Show density values on the y-axis (like mpg does)
  • Show variable values on the x-axis
  • Consistently display both axes for all variables

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions