plotly / plotly/plotly.R

ggplotly not working with control chart library ggQC

Aperta
#2,177 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
R
Stelle
2.7k
Fork
641
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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:

image

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:

image

Could this be related to the ggplotly argument layerData? Any help is appreciated.

thx

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia eseguendo la riproduzione R fornita con ggplotly, ggplot2 e ggQC, confrontando il grafico funzionante con la versione che usa stat_QC(). Analizza l’errore segnalato “alpha must be of length 1 or the same length as x” e conferma che i layer della carta di controllo vengono renderizzati tramite ggplotly senza un errore bloccante.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
r
Ambito
data-visualization
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.