question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

horizontal bar chart using coord_flip()

See original GitHub issue

Is it possible to make a horizontal bar chart? In R I would make a regular bar chart and use coord_flip() but that doesn’t seem to be working. Am I doing something incorrectly or has this not yet been implemented?

This gives me a regular bar chart

discovery_time = pd.DataFrame(col.aggregate({'$project':{'unit':'$timeline.discovery.unit'}})['result'])
p = ggplot(discovery_time, aes('unit'))
p + geom_bar(stat="identity",fill="steelblue")

I’m trying to do this

discovery_time = pd.DataFrame(col.aggregate({'$project':{'unit':'$timeline.discovery.unit'}})['result'])
p = ggplot(discovery_time, aes('unit'))
p + geom_bar(stat="identity",fill="steelblue") + coord_flip()

Issue Analytics

  • State:open
  • Created 10 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
damahacommented, Jan 13, 2017

It would really be awesome if coord_flip would be implemented! I want to do a vertical lineplot because my y-axis variable is related to altitude, this is more intuitive than connecting points along the x-axis.

Do anyone know if there is a hack to do this? like inverting the underlying matplotlib axis object that ggplot uses or something.

0reactions
jankatinscommented, Mar 7, 2014

+coord_flip() is interesting because it would also flip other thingies (in most case it would probably simply switch x and y mappings, but not in case of bars. There are also other coord_* functions…

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to create a horizontal bar chart using ggplot2 with labels ...
To create a horizontal bar chart using ggplot2 package, we need to use coord_flip() function along with the geom_bar and to add the...
Read more >
Cartesian coordinates with x and y flipped — coord_flip • ggplot2
Flip cartesian coordinates so that horizontal becomes vertical, and vertical, horizontal. This is primarily useful for converting geoms and statistics which ...
Read more >
How to Create a GGPlot Horizontal Bar Chart - Datanovia
Horizontal bar chart. It's very easy to create a horizontal bar chart.You just need to add the code coord_flip() after your bar chart...
Read more >
Turning a Table into a Horizontal Bar Graph using ggplot2
The layer coord_flip() will flip the x- and y-axes creating a horizontal bar graph, instead of vertical. The layer ggtitle() will title the...
Read more >
Horizontal bar plots using coord_flip() - need left aligned ...
In your ggplot2 calls, your geom_text() function is inheriting the value of Score to be the y location. I would put Score as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found