`geom_col()` with categories on vertical axis does not render correctly

Open
#917 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
python

Research direction

Run the provided plotnine 0.14.5 reproducer using geom_col() with factor(gear) mapped to the vertical axis, then compare it with the coord_flip() example. Trace the geom_col rendering path and verify that the vertical-category result matches the expected figure without requiring coord_flip().

Written by the indexing model from the issue text.

Description

Orientation Aware Geoms

I'm using plotnine version 0.14.5. The following code

from plotnine import ggplot, aes, geom_col, coord_flip
from plotnine.data import mtcars

(ggplot(mtcars, aes(y = "factor(gear)", x = "mpg"))
    + geom_col()
)

produces this figure

Image

However, we should expect this:

Image

which I created using coord_flip():

(ggplot(mtcars, aes(x = "factor(gear)", y = "mpg"))
    + geom_col()
    + coord_flip()
)

I noticed this issue in a more complex project and created this reprex for illustration.

Dominant language
Python
Stars
4.8k
Forks
269
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from has2k1/plotnine

All issues in has2k1/plotnine

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.