Skip to content

Bar chart x-axis factor order wrong #242

@13bzhang

Description

@13bzhang

When I was writing tests for #241, I came across this problem where the bar chart x-axis factor level order is wrong.

R code:

set.seed(23049)
long_items <- data.frame(cat1 = sample(x = LETTERS[1:10], 
                                  size = 100, replace = TRUE),
                    cat2 = sample(x = LETTERS[1:10],
                                  size = 100, replace = TRUE))
p <- ggplot(long_items, aes(cat1, fill=cat2)) + geom_bar(position="dodge")
py$ggplotly(p)

ggplot2 figure:
abc_ggplot2

Note the figure above has the x-axis in alphabetical order.

Plotly figure (based on PR #241): https://plot.ly/~13bzhang/1365/count-vs-cat1/
abc_plotly_master

Now the x-axis is not in alphabetical order.

@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