geom-vline

How to avoid the crossing effect in legend with geom_vline() and geom_hline on the same scatter plot?

谁都会走 提交于 2021-02-16 14:26:52
问题 I created a scatter plot with geom_hline() and geom_vline() , the plot is good but the legend entries are not how I would like to make them appear. The vline (Restauration) and hline (Threshold) are crossing each other in the legend, making it confusing. I want the restauration legend entry to be an orange vertical line and the Threshold legend entry to be a horizontal black line. I tried several things suggested in other posts, with guide_legend(override.aes()) or with show.legend = F but

ggplotly() does not display geom_vline / geom_hline when data is POSIXct

纵然是瞬间 提交于 2019-12-21 20:03:52
问题 I am trying to make a graph with "time markers". These time markers are vertical lines for certain dates. Time data are POSIXct format. I would like to use the awesome interactive interface of Plotly and use my ggplot objects in it. The problem is that these "time markers" doesn't show in after using ggplotly(). I ave already tried with plotly::add_segments() but it does not work. Here are two reproductible examples : 1. With non-POSIXct data it works fine # dummy dataset df2 = data.frame(id