ggplotly arrows not functioning
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- R
- Estrelas
- 2.7k
- Forks
- 641
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
Build a data.frame
tempDf <- data.frame("x" = c(22.1, 22.1, 14.4, 32.1, 22.0, 32.1, 84.3, 15.9, 15.9, 11.8, 11.8, 25.1, 15.7, 22.4, 35.1, 36.6, 70.4, 65.2, 42.9, 36.3, 47.8),
"y" = c(21.0, 21.0, 39.8, 47.6, 69.6, 95.0, 94.8, 17.3, 17.3, 27.6, 27.6, 90.3, 85.7, 94.1, 72.3, 71.5, 100.0, 92.4, 76.9, 34.6, 4.9),
"endX" = c(NA, 13.1, 31.9, 22.0, 29.7, 84.3, 94.4, NA, 15.1, NA, 25.0, 14.3, 22.4, 59.6, NA, 70.4, 65.9, 44.2, 38.3, 48.3, 72.1),
"endY" = c(NA, 33.3, 46.0, 69.6, 93.5, 94.8, 51.6, NA, 22.1, NA, 90.3, 85.4, 94.1, 96.8, NA, 100.0, 91.5, 80.8, 37.1, 5.2, 36.9),
"index" = c(1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0),
"string"= c(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0) )
Make plot using ggplot.
ggplot(tempDf, aes(x=x, y=y)) + geom_point(size = 4, shape = 0, aes(fill="green")) +
geom_text(aes(label= string), size = 2) +
geom_segment(data = tempDf, aes(x=x, xend=endX, y=y, yend=endY, group = index, color=as.factor(index)), size = .3, arrow=arrow(length=unit(0.3,"cm")) ) + xlim(0,100) + ylim(0,100) +
theme(panel.grid.minor = element_blank(),
panel.grid.major = element_blank(),
panel.background = element_rect(fill = "grey90"),
axis.ticks.x = element_blank(),
axis.ticks.y = element_blank(),
axis.text.x = element_blank(),
axis.text.y = element_blank(),
#legend.title=element_blank(),
#legend.margin=unit(-.4, "cm"),
plot.margin=unit(c(0, 0, 1.3, -1), units="cm"), #top, right, bottom, left
legend.text = element_text(size = 14, face = "bold") ) +
xlab("") + ylab("")
Makes a plot that looks like this.

Turn it into a plotly plot in and drop it in a shiny app (literally the same code with a 'ggplotly' tacked on)
And this is the output.
No arrows.
In addition, in the original plot I can do both a geom_point() with a empty square and a geom_text() and get the numerals to appear inside the square. That's also not appearing here. That is technically a separate issue. If you like I can open up another thread for that issue.
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Direção de pesquisa
Comece executando o exemplo de ggplot fornecido; em seguida, passe o mesmo gráfico para ggplotly dentro de um aplicativo Shiny e compare a saída renderizada. Concentre-se na seta de geom_segment e na combinação de geom_point com geom_text descrita no relatório. Considera-se concluído quando as setas forem renderizadas no gráfico interativo e os rótulos dos pontos aparecerem conforme esperado.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- r
- Domínio
- data-visualization
- Tipo de issue
- Bug
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Status de atividade
- Estagnada
- Clareza
- Claramente especificada
- Facilidade para iniciantes
- 35/100