Closed CopyOfA closed 8 months ago
I presume you do not want to read va from a column 'top' of your dataframe. If so, you need to pass it outside of the aes.
The docs on geom_text
specify to put it in the aes
field: https://plotnine.readthedocs.io/en/v0.12.4/generated/plotnine.geoms.geom_text.html#plotnine.geoms.geom_text
If I put the va="top"
in the geom_text
call, then all the text is place at the default location: "center".
Each mapping can be either sourced from the underlying dataframe (with an 'aesthetic' = aes() call), or set to a constant value by being passed 'on the outside'.
See for example the label being set to the constant 'name' (below).
At least in my version (0.12.2), the text does shift:
I see, I was confused about the meaning of the positions (i.e., "top" puts the label below the point). Thanks for helping out!
I am using Python 3.11.5, with plotnine 0.12.1. I am trying to place numerical labels above geom_col bars using the following code:
Here
plot_data
is a Pandas dataframe with four columns: "variable", "value", "team1", "team2". When I callsave
on this plotnine object, I get the following error: