Changing the axis title
See original GitHub issueHello,
I’m coming from R
+ ggplot2
and I’m not sure what I’m doing wrong here to change the axis title.
from plotnine import *
from plotnine.data import *
p = ggplot(aes(x='displ', y='cty'), mpg) + scale_x_continuous(name="foo")
p + geom_point()
From the docs
class plotnine.scales.scale_x_continuous(**kwargs) name (str, optional) – Name used as the label of the scale. This is what shows up as the axis label or legend title.
R
equivalent:
library(ggplot2)
data(mtcars)
ggplot(mtcars, aes(x=disp, y=mpg)) + geom_point() + scale_x_continuous(name="foo")
Thanks for taking a look, and sorry if I’ve misunderstood due to being new to plotnine
.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Change axis labels in a chart in Office - Microsoft Support
Right-click the category labels to change, and click Select Data. ... In Horizontal (Category) Axis Labels, click Edit. In Axis label range, enter...
Read more >How to Add Axis Labels in Excel Charts - Step-by-Step (2022)
How to add axis titles. 1. Left-click the Excel chart. 2. Click the plus button in the upper right corner of the chart....
Read more >ggplot2 title : main, axis and legend titles - Easy Guides - Wiki
Change the appearance of the main title and axis labels ... The arguments below can be used for the function element_text() to change...
Read more >Excel charts: add title, customize chart axis, legend and data ...
In Excel 2013 - 365, a chart is already inserted with the default "Chart Title". To change the title text, simply select that...
Read more >How to Change Chart Names on the Vertical & Horizontal Axis ...
Click Design on the main menu, then Layout and finally, select Axis Title or Data Labels according to which you want to modify....
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 FreeTop 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
Top GitHub Comments
Update: when I use
ggplot2
, I’ll frequently doscale_y_continuous("")
when the label is obvious or unhelpful.I just found that passing an empty string reverts to whatever the column label is. In other words,
name='foo'
works, but notname=''
. I can pass a space to hack this, but wanted to bring it up.Taking an empty string would match
ggplot2
behavior to remove an axis label.Are these all in issues? I’ve been using
R
’sggplot2
for maybe 7 years and the fact that you’ve built it forpython
is about the coolest thing ever. I’ve putzed with some other libraries, but when I just need to get something done, I use this!tl;dr version: do you need help with some of these things? I can certainly write up some examples. For example I noticed there aren’t any for
geom_text()
andannotate()
yesterday…If you have an overall strategy (for example, “Replicate R’s ggplot2 pages over time”), I will happily help out.