Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 绘图仪中的水平虚线_R_Plotly_Bubble Chart - Fatal编程技术网

R 绘图仪中的水平虚线

R 绘图仪中的水平虚线,r,plotly,bubble-chart,R,Plotly,Bubble Chart,我试图在plotly制作的气泡图中绘制虚线,但在执行代码时发生了一些奇怪的事情。虚线出现了,但在虚线的两端画了两个大气泡,我不明白为什么会这样。代码如下: iris2 <- iris binary_variable <- factor(sample(x = c(0, 1), size = nrow(iris2), replace = TRUE)) iris2 <- cbind(iris2, binary_variable) m <- glm(binary_variabl

我试图在plotly制作的气泡图中绘制虚线,但在执行代码时发生了一些奇怪的事情。虚线出现了,但在虚线的两端画了两个大气泡,我不明白为什么会这样。代码如下:

iris2 <- iris
binary_variable <- factor(sample(x = c(0, 1), size = nrow(iris2), replace = TRUE))
iris2 <- cbind(iris2, binary_variable)

m <- glm(binary_variable ~ Sepal.Length + Sepal.Width*Species, family = binomial, data = iris2)

plot_ly(x = ~hatvalues(m), y = ~rstudent(m), type = "scatter",
  mode="markers", colors=~colors, size=~cooks.distance(m),
  marker = list(symbol = 'circle', sizemode = 'diameter',
                line = list(width = 2, color = '#FFFFFF'), opacity=0.4),
  text = names(rstudent(m)),hoverinfo = 'text') %>% 
  layout(title = "Gràfic d'influència", xaxis = list(title = "Hat Values"), yaxis = list(title = "Studentized Residuals")) %>%
  add_segments(x=min(hatvalues(m)), y=2, xend=max(hatvalues(m)), yend=2, line=list(color="red", width = 1, dash = 'dash'))
iris2