Open TerryGamon opened 1 month ago
I want to add space between the x-axis labels and the x-axis. But element_text(margin =) seems to be ignored?
First:
import plotnine as p9 from plotnine.data import mtcars mtcars=mtcars.head(5) (p9.ggplot(mtcars) + p9.geom_col(p9.aes(x='name',y='mpg')) + p9.labs(x='') )
So far so good. Now add space:
(p9.ggplot(mtcars) + p9.geom_col(p9.aes(x='name',y='mpg')) + p9.labs(x='') + p9.theme(axis_text_x=p9.element_text(margin={'t': 40, 'units':'pt'})) )
nothing changes
just to clarify what I want to achive, here the ggplot dplyr code:
library(tidyverse) mtcars = as_tibble(mtcars,rownames = "name") mtcars = mtcars |> head(5) ggplot(mtcars) + geom_col(aes(x=name,y=mpg))+ labs(x='')+ theme(axis.text.x = element_text(margin = margin(10)))
Use axis_ticks_pad.
The margin will work in some future version.
margin
I want to add space between the x-axis labels and the x-axis. But element_text(margin =) seems to be ignored?
First:
So far so good. Now add space:
nothing changes
just to clarify what I want to achive, here the ggplot dplyr code: