Adding text shrinks bar chart area
Personne n'a encore pris cette issue.
- Langage dominant
- R
- Étoiles
- 2.7k
- Forks
- 641
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
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
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Exécutez le reprex R fourni avec plotly::plot_ly(), add_bars() et add_text(), puis comparez-le à la version sans add_text(). Suivez le comportement de la mise en page du graphique responsable de la réduction de la zone verticale du graphique en barres ; le travail est terminé lorsque l’ajout de texte n’augmente plus la distance entre la barre inférieure et le zéro de l’axe x.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- r
- Domaine
- data-visualization
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 42/100