Skip to content

Equal scaling of axes not working #218

@13bzhang

Description

@13bzhang

This is one of the unsupported features from the cookbook, see Issue #161.

There's a problem with setting the scaling of the axes to an equal ratio, with one visual unit being representing the same numeric unit on both axes. There's also a problem when I set them to ratios other than 1:1.

# Data where x ranges from 0-10, y ranges from 0-30
set.seed(202)
dat <- data.frame(
    xval = runif(40,0,10),
    yval = runif(40,0,30)
)
sp <- ggplot(dat, aes(xval, yval)) + geom_point()

# Force equal scaling
sp + coord_fixed()

Cookbook:
1-1_scaling

Plotly:
1-1_scaling_plotly

# Equal scaling, with the total x axis the same length as the total y axis
sp + coord_fixed(ratio=1/3)

Cookbook:
1-3_scaling

Plotly:
1-3_scaling_plotly

cc @cpsievert @chriddyp @mkcor

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions