plotly / plotly/plotly.R

Adding text shrinks bar chart area

Abierto
#2,253 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
R
Estrellas
2.7k
Forks
641
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Adding text shrinks the bar chart area. Below we render a bar chart where the bars are on the x-axis. The add_text() call actually vertically shrinks the area of the plot, such that the distance from the bottom bar to the x-axis "0" is increased. If you run this output without the add_text() call, you'll see that the vertical width of the bar charts increases.

Adding text should not have an effect on the bar chart.

# Shrunken plot area
require(plotly)
#> Loading required package: plotly
#> Loading required package: ggplot2
#> 
#> Attaching package: 'plotly'
#> The following object is masked from 'package:ggplot2':
#> 
#>     last_plot
#> The following object is masked from 'package:stats':
#> 
#>     filter
#> The following object is masked from 'package:graphics':
#> 
#>     layout

cats = c(letters, paste0(letters,'2'), paste0(letters,'3'), paste0(letters,'4') )

data = data.frame(
  y_axis_cat = rep(cats,8),
  x_axis_num = rep(5,length(cats)*8),
  cat = rep(paste0('Cat ',1:8), length(cats))
)

p = plotly::plot_ly(data) %>%
  plotly::add_bars(
    x = ~x_axis_num,
    y = ~y_axis_cat,
    color=~cat
  ) %>%
  plotly::add_text(
    x = 40,
    y = ~y_axis_cat,
    text = '40'
  ) 

Created on 2023-04-10 with reprex v2.0.2

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Ejecuta el reprex de R proporcionado con plotly::plot_ly(), add_bars() y add_text(), y compáralo con la versión sin add_text(). Rastrea el comportamiento del diseño del gráfico responsable de la reducción del área vertical del gráfico de barras; el trabajo estará terminado cuando añadir texto ya no aumente la distancia entre la barra inferior y el cero del eje x.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
r
Área
data-visualization
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
42/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.