ggplotly not working with control chart library ggQC
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
Brief description of the problem:
Adding some lines and labels using the ggQC library causes a hard fail.
This code works with ggplotly:
min_date = as.Date(min(lots_df_filtered()$DATE))
max_date = as.Date(max(lots_df_filtered()$DATE))
if (!is.na(min_date)) {
num_days = length(seq(from = min_date, to = max_date, by = 'day')) - 1
date_breaks <- if(num_days <= 31) 'day' else 'week'
XmR_Plot <-
ggplot(lots_df_filtered(), aes(x = as.Date(DATE), y = YRS_YIELD)) +
geom_point(alpha = .5) + geom_line() +
labs(title=paste0(input$mfg_step_name, ' Lot Yield Control Chart')) +
scale_x_date(date_breaks=date_breaks) +
theme_ipsum_ps() +
theme(axis.text.x = element_text(angle = 60, vjust = 0.5, hjust=1),
axis.title.x=element_blank())
output$lot_time_series <- renderPlotly(ggplotly(XmR_Plot))
}`
Produces a nice chart as so:

The following code results in an error (alpha must be of length 1 or the same length as x):
min_date = as.Date(min(lots_df_filtered()$DATE))
max_date = as.Date(max(lots_df_filtered()$DATE))
if (!is.na(min_date)) {
num_days = length(seq(from = min_date, to = max_date, by = 'day')) - 1
date_breaks <- if(num_days <= 31) 'day' else 'week'
XmR_Plot <-
ggplot(lots_df_filtered(), aes(x = as.Date(DATE), y = YRS_YIELD)) +
geom_point(alpha = .5) + geom_line() +
stat_QC(method = "XmR",
auto.label = T,
label.digits = 2,
show.1n2.sigma = T
) +
labs(title=paste0(input$mfg_step_name, ' Lot Yield Control Chart')) +
scale_x_date(date_breaks=date_breaks) +
theme_ipsum_ps() +
theme(axis.text.x = element_text(angle = 60, vjust = 0.5, hjust=1),
axis.title.x=element_blank())
output$lot_time_series <- renderPlotly(ggplotly(XmR_Plot))
}
Here is what the ggplot looks like when I do not use ggplotly and do use ggCC:

Could this be related to the ggplotly argument layerData? Any help is appreciated.
thx
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
Commencez par exécuter la reproduction R fournie avec ggplotly, ggplot2 et ggQC, en comparant le graphique fonctionnel avec la version utilisant stat_QC(). Examinez l’échec signalé « alpha must be of length 1 or the same length as x » et confirmez que les couches de la carte de contrôle sont rendues via ggplotly sans échec bloquant.
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é
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100