简体   繁体   中英

Size parameter in Plotly R scatter plot with data and value does not work

I have a data frame like this:

dput(df)
structure(list(date = structure(c(16476, 16477, 16524, 16541, 
16595, 16658, 16769, 16804, 16819, 16819, 16828, 16833, 16875
), class = "Date"), y = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L)), .Names = c("date", "y"), row.names = c(NA, 
-13L), class = c("tbl_df", "tbl", "data.frame"))

I use plotly R to plot a scatter plot like this:

plot_ly(df, x = date, y = y, mode = 'markers')

The above statement works perfectly fine.

Now, I just want to increase the size of the points in the scatter plot. Trying this messes up the whole plot including the x axis date scale:

plot_ly(df, x = date, y = y, mode = 'markers', size = 10)

Any idea what is going on? My version is:

packageVersion('plotly')
[1] ‘3.5.5’

On the dev github version it works:

packageVersion('plotly')
> '4.5.6.9000'

p1 <- plot_ly(df, x = ~date, y = ~y) %>%
    add_markers()
p2 <- plot_ly(df, x = ~date, y = ~y) %>%
    add_markers(size = 10)
subplot(p1, p2)

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM