Subsequent geom_tile call is not zero indexed for x axis. #905
-
Hello, I'm trying to understand why my second call to i.e.. The first Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Please post a minimal reproducible example. |
Beta Was this translation helpful? Give feedback.
-
import pandas as pd
from plotnine import ggplot, aes, geom_tile, scale_y_reverse
df1 = pd.DataFrame([[0,1,2], [3,4,5], [6,7,8]])
df1 = df1.reset_index().melt('index')
df1.columns = ['row', 'column', 'value']
df2 = pd.DataFrame({"row": [0, 0], "column": [1, 2], "value": list(range(2))})
(ggplot(df1, aes("column", "row", fill="value"))
+ geom_tile()
+ geom_tile(data=df2,
size=2, fill=None, color="black")
+ scale_y_reverse()
) The current output aligns with what I would expect a |
Beta Was this translation helpful? Give feedback.
With the way you create the dataframe,
df1["column"]
is discrete (dtype=object) whiledf2["column"]
is continuous (dtype=int).So if you do
It should act as you expect.