2

Having an issue convincing python-ggplot to honor different vlines in different panels. R's ggplot2 geom_vline documentation suggests a way of doing so, which I attempted to follow here:

df = pd.DataFrame({'x': np.random.random(size = 200), 'y': np.random.random(size = 200), 'cat': np.random.randint(0, high = 4, size = 200)})

vlines = pd.DataFrame({'z': [0.25, 0.375, 0.5, 0.75], 'vs': [0,0,1,1], 'am': [0,1,0,1]})

pl = ggplot(df, aes('x','y')) + \
        geom_point() + \
        facet_wrap('cat', scales = 'fixed') + \
        geom_vline(aes(xintercept = 'z', linetype = 'dash'), vlines)

Doesn't work.

Is this something that just hasn't been added to python-ggplot yet, or am I misinterpreting how to analogize the r ggplot2 documentation?

James
  • 325
  • 1
  • 11

1 Answers1

0

See https://stackoverflow.com/a/44197340/6805670

You'll need to create another df with xintercept for each facet

IVIM
  • 2,167
  • 1
  • 15
  • 41