My geom_curve function does not work

I'm trying to plot using geom_segment and geom_curve. While there's absolutely no trouble getting geom_segment to work, I'm puzzled as to why geom_curve lines aren't showing up.

I'm replicating examples from tutorials and thus I know it's not an error with my codes.

Has this happened to anyone else ?

I'd gladly appreciate any advice!

Hi and welcome!
There are many possibilities why your code does not work, so without any further information we cannot give you any useful help.
If you could give us a reproducible example (FAQ: What's a reproducible example (`reprex`) and how do I do one?) people can have a look at your problem and help you finding a solution.

1 Like

Apologies I should've clarified with an example earlier.

output$graph <- renderPlotly({

shape <- data.frame(
x = c(50, 120, 90, 50),
y = c(15, 15, 90, 120))

p <- ggplot(shape, aes(x = x, y = y)) +
geom_curve(aes(x = 20, xend = 80, y = 15, yend = 15, curvature = 0.5, angle = 50, color = 'red')) +
geom_ellipse(aes(x0 = 0, y0 = 10, a = 10, b = 6, angle = pi / 2, m1 = 6)) +
coord_fixed() + xlim(0,10) + ylim(0,30)

p

})

I just found out that it doesnt work within the context of RenderPlotly. However it works if I change it to RenderPlot. This goes for the geom_ellipse function as well.

Gladly appreciate your advice on this, thank you.

renderPlotly() is for plots generated with the plotly package not with ggplot2, if you still want to use it, you have to convert your plot with the ggplotly() function.

Yup I tried piping it to ggplotly() , it still doesnt show up . Is there a bug that I have to fix?

If I remember correctly ggplotly() is not pipe friendly, you have to pass p explicitly.

ggplotly(p)

If this doesn't help, please provide a reproducible example (reprex) illustrating your issue. Have a look at this resources, to see how to create one for a shiny app