Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

position_dodge() with order aesthetics for stacking and dodging #6775

Open
@alyst

Description

@alyst

This plots as expected:

ggplot(mpg, aes(x=class,order=drv,fill=drv))+    geom_bar(position= position_dodge(preserve="single"))+    theme_bw()
Image

This one is almost correct, but it seems the widths of the bars take into account the number of groups (5) rather then the number of distinct order values (3):

ggplot(mutate(mpg,drvXyear= paste0(drv,"|",year)),       aes(x=class,order=drv,fill=drvXyear))+    geom_bar(position= position_dodge(preserve="single"))+    theme_bw()
Image

ggplot2 v4.0.1

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


      [8]ページ先頭

      ©2009-2025 Movatter.jp