has2k1 / has2k1/plotnine

Specify axis ordering for specific facet in multi-facet plot

Open
#581 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Documentation Question
Dominant language
Python
Stars
4.8k
Forks
254
Avg merge
10h 35m
Merged PRs (30d)
9

Description

Correct me if I am wrong, but it is not possible(?) to create a multi-facet plot with continuous facets where one of the facets reverses the x (y) axis in a particular facet. For example if I have:

df = pd.concat([
    pd.DataFrame({'x': [1, 2, 3, 4, 5, 6, 7, 8], 'level': [2, 4, 9, 25, 36, 49, 64], 'pane': 'left'}),
    pd.DataFrame({'x': [1, 2, 3, 4, 5, 6, 7, 8], 'level': [1, 3, 8, 24, 30, 40, 55], 'pane': 'right'})
])

(ggplot() + 
    geom_area(aes(x='x', y='level', fill='pane'), data=df) +
    facet_grid(". ~ pane"))

Supposing that I want the 'left' pane to be ordered from 8 downto 1 and the 'right' ordered from 1 to 8, is it possible to accomplish this in the same ggplot()?

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

Start with the facet_grid entry point and reproduce the supplied geom_area example to inspect how continuous facet axes are ordered. Determine whether per-facet reversal can be specified independently, and define completion as supporting the requested opposite ordering for the left and right panes in one plot, with coverage for that behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
pandas, python
Domain
data-visualization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.