horizontal bar chart using coord_flip()
See original GitHub issueIs 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:
- Created 10 years ago
- Comments:6 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
+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 othercoord_*
functions…