Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

[R] Layout log scale issue with add_trace

I’m trying to make a simple graph with some curves overlaid on a scatterplot.
My code look something like this:

p = plot_ly(curve_data_all, x = Concentration, y = GR, color = exp)
p %>% add_trace(p, x = test_plot$concentration, y = test_plot$GR, mode = “markers”, color = test_plot$experiment)
layout(p, xaxis = list(type = “log”),
title = “GR value vs. Concentration”,
xaxis = list(title = “Concentration”, range = c(0,10)),
yaxis = list(title = “GR”, range = c(0,1)))

The problem is that when I run this code, it produces a log-scaled plot with curves, but without the points that should have been added in “add_trace”. If I comment out the “layout” section, the plot shows both curves and points like I want, but it’s not on a log-scale, which I need.

Are you able to share the data contained within curve_data_all? It’ll help a lot :slightly_smiling:

Also, since you are manually specifying axis ranges maybe check to make sure that the data points added in add_trace() actually lie within that range?

I actually switched to ggplotly and got this to work… If I have time I’ll try to figure out what happened and post a solution or an example with data available.