1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
# Plotly librarie library(plotly) # Use the mtcars dataset : head(mtcars) # Make the graph plot_ly(mtcars, x = ~mpg, y = ~disp, type="scatter", mode = "markers" , marker=list( color=ifelse(mtcars$mpg>20,"red","blue") , opacity=0.5 , size=30) ) %>% #Add the segment with add_trace add_trace(x = c(20, 20), y= c(min(mtcars$disp), max(mtcars$disp)), mode = "lines") %>% #Layout layout(showlegend=F) |
Not what you are looking for ? Make a new search ![mediatagger]
Leave a Reply