Open bcdunbar opened 7 years ago
Weird, I'm getting this error, which I've never seen before:
Error in curl::curl_fetch_memory(url, handle = handle) :
Failure when receiving data from the peer
It looks like the grid is being created OK -- https://plot.ly/~cpsievert/19002/
But the actual plot creation is failing for some reason...
At least the error can be resolved by doing it this (preferred) way. Remember that when you specify attributes in plot_ly()
, those attributes will be inherited in downstream traces (unless you set inherit = FALSE
).
p <- plot_ly() %>%
add_trace(
type = 'carpet',
a = c(4, 4, 4, 4.5, 4.5, 4.5, 5, 5, 5, 6, 6, 6),
b = c(1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3),
y = c(2, 3.5, 4, 3, 4.5, 5, 5.5, 6.5, 7.5, 8, 8.5, 10),
aaxis = list(
tickprefix = 'a = ',
ticksuffix = 'm',
smoothing = 1,
minorgridcount = 9
),
baxis = list(
tickprefix = 'b = ',
ticksuffix = 'Pa',
smoothing = 1,
minorgridcount = 9
)
) %>%
add_trace(
type = 'scattercarpet',
a = c(4, 4.5, 5, 6),
b = c(2.5, 2.5, 2.5, 2.5),
line = list(
shape = 'spline',
smoothing = 1,
color = "blue"
),
marker = list(color = "blue")
)
api_create(p)
Two worrisome issues remain though: (1) The colors are translated correctly (2) "Unofficial" attributes will have to be filtered out before sending the API request
(1) seems more prudent...will hopefully have a fix tomorrow.
ok, (1) is fixed via 797b8c5986b1a07cb090d9631e59036665a5a60a, but (2) might require a more substantial fix
I seem to be encountering this as well, this is my first use of plotly, so perhaps I'm just doing something wrong, but google searches have taken me here. I've added the code I used to the community question posted by the original OP in this git issue.
@davidparks21 , where is your code?
@cpsievert Hi, do you solved the problem? I have exact same issue when i creat a table from a dataframe with plot_ly()
Hi, I know this is old and has been closed, but I am facing the same error with this code:
p <- df_all %>%
plot_ly(
x = ~day,
text = ~province,
transforms = list(
list(
type = 'filter',
target = ~province,
operation = '=',
value = unique(df_all$province)[1]
)
)) %>%
add_trace(y = ~S, name = 'susceptible', type='scatter',mode = 'lines') %>%
add_trace(y = ~I, name = 'infected (predicted)', type='scatter',mode = 'lines') %>%
add_trace(y = ~R, name = 'removed', type='scatter', mode = 'lines') %>%
add_trace(y = ~infected, name = 'infected (actual)', type='scatter', mode = 'markers') %>%
layout(shapes=list(list(type='rect',
xref='x',yref='y',
x0=18,x1=28,y0=1,y1=15000000,
fillcolor='blue',opacity=0.1,line=list(color='blue'))),
title="Effectiveness of Social Distancing Measures",
xaxis = list(title="Day"),
yaxis = list(title="Number of subjects (log)",type = "log"),
updatemenus = list(
list(
type = 'dropdown',
xanchor="right",
yanchor="bottom",
active = 0,
buttons = list(
list(method = "restyle",
args = list("transforms[0].value", unique(df_all$province)[1]),
label = unique(df_all$province)[1]),
list(method = "restyle",
args = list("transforms[0].value", unique(df_all$province)[2]),
label = unique(df_all$province)[2]),
list(method = "restyle",
args = list("transforms[0].value", unique(df_all$province)[3]),
label = unique(df_all$province)[3])
)
)
)
api_create(p)
@francismcguire did you end up getting a fix? I'm running into the same issue
Coming across this in few different ways when making docs and noticed it raised in the community forum too.
https://community.plot.ly/t/remove-edit-chart-from-embedded-html-graph-made-in-r/1601/2
When using
scattercarpet
type script below, I kept receiving the error:Error: Client error: (400) Bad Request Figure field is invalid. Reason: Raw data arrays are not allowed at this endpoint. Use grid references instead. Raw data found at the following paths in the figure [('data', 1, u'y')]