Two y Axes in RBokeh

68 views Asked by At

I need to draw a combo chart including two series of bars and two lines using RBokeh. The syntax for adding bars and lines is quite simple but I cannot add a second y-axis. y_axis position can be set to left or right but it does not work when I use them simultaneously.

p=figure(width = 600, height = 600) %>%
         ly_points(Data2Chart[c(4,1)], hover = dat) %>%
         ly_lines(Data2Chart[c(4,1)], legend = "X") %>%
         y_axis(position = 'right') %>% 
         y_axis(position = 'left')
1

There are 1 answers

1
mnist On

I dont really think this is possible and actually also not quite advisible anyways even if it would be (see some discussion about this issue here). I would suggest doing two separate graphs and add them via grid_plot().

A really hacky way would be to draw the second axis by yourself via ly_abline(v=...). At least in my experience, rBokeh requires a lot of hackiness