Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Groups not sorted similarly when using facets #679

Closed
ASmirnov-HORIS opened this issue Feb 2, 2023 · 2 comments
Closed

Groups not sorted similarly when using facets #679

ASmirnov-HORIS opened this issue Feb 2, 2023 · 2 comments
Assignees
Labels

Comments

@ASmirnov-HORIS
Copy link
Collaborator

Example:

data = {
    'x': [0, 0, 1, 1, 0, 0, 1, 1],
    'f': ['A', 'B', 'B', 'A', 'B', 'A', 'A', 'B'],
    'g': ['X', 'X', 'X', 'X', 'Y', 'Y', 'Y', 'Y'],
}
ggplot(data) + \
    geom_bar(aes(x='x', fill='f')) + \
    facet_grid(x='g')

Result:

Expected (as in ggplot2):


The case isn't connected with any specific position type, e.g. the same problem comes up for the following plot:

ggplot(data) + \
    geom_bar(aes(x='x', fill='f'), position='dodge') + \
    facet_grid(x='g')

@IKupriyanov-HORIS
Copy link
Collaborator

Another example:

data = {
    "g": ["X", "X", "X", "X", "X", "Y", "Y", "Y", "Y", "Y"],
    "f": ["A", "B", "C", "D", "E", "E", "D", "C", "B", "A"],
    "z": ['Q', 'Q', 'Q', 'E', 'E', 'W', 'W', 'W', 'Q', 'E'],
    "x": ['L', 'L', 'L', "L", "R", "L", "L", "L", "R", "R"],

}
ggplot(data) + geom_bar(aes(x='x', fill='f', color='z')) + \
 geom_label(aes(x='x', label='f'), position=position_stack(vjust=0.5), stat='count') + \
    facet_grid(x='g')

Result:
image

@alshan
Copy link
Collaborator

alshan commented May 10, 2023

Fixed in v3.2.0

@alshan alshan closed this as completed May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants