I am trying to make a figure that shows time on the x-axis and dots on the y-axis whenever a column has a specific (discrete) value.
Here is some example data:
dat = pd.DataFrame({
'time': [0, 15, 30],
'A': [np.nan, np.nan, 'A'],
'B': ['B', 'B', np.nan],
})
Now I am trying to show a dot in the 'A' column whenever column 'A' shows letter 'A'. I tried this:
(gg.ggplot(dat, gg.aes('time', 'A'))
+ gg.geom_point()
+ gg.scale_y_discrete(name='', limits=list('A'))
)
But nothing shows up: link to figure
Then, I changed the y-limits of the plot:
(gg.ggplot(dat, gg.aes('time'))
+ gg.geom_point(gg.aes(y='A'))
+ gg.scale_y_discrete(name='', limits=list('ABCD'))
)
Now, the dot I wanted shows up: Column 'A' shows value 'A' at time 30, and indeed, theres a dot there. But very weirdly, the plot also shows two dots in the 'D' column: link to figure
I played around a little bit with limits and column names, and no dots show up at all as long as the limits include less than 4 values; after that, the dots I want show up, but the NaN values also get plotted, in the column of the last letter in the limits.
Does anyone know what is going on here? And could you help me make this figure?