Skip to content

scale_x_reverse( ) in renderPlot ( ) or renderPlotly( ) #4022

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
vitor-mendes-iq opened this issue May 22, 2020 · 1 comment
Closed

scale_x_reverse( ) in renderPlot ( ) or renderPlotly( ) #4022

vitor-mendes-iq opened this issue May 22, 2020 · 1 comment

Comments

@vitor-mendes-iq
Copy link

Since I updated R to version 4.0 the scale_x_reverse () function has stopped working together with renderPlot () or renderPlotly( ), which I use in a shiny app that I develop ...
However when I test scale_x_reverse () out of the render it works fine. It is worth mentioning that in all other versions of R it was working normally in both Windowns (7, 8 and 10) and Linux (Ubunto, mint, Debian, Suse). Now I am use Windowns 10, R (4.0), RStudio (1.2.5042).

Can someone help me?


Brief description of the problem

`library(shiny)
library(ggplot2)
library(plotly)


ui <- fluidPage(
        fluidRow(align = "center",
          mainPanel(
           plotly::plotlyOutput("plot_multi")
          )
        )
)
  

server <- function(input, output) {

# Data.frame
z <<- runif(1001, min=0, max=1000000)
f <<- seq(0,10,0.01)
testy_multi <<- data.frame(Chemical_Shift=f,Spectrum=z)
ranges_multi <- reactiveValues(x = c((min(testy_multi$Chemical_Shift)), max(testy_multi$Chemical_Shift)), y = c(-100,1000000))
spectrums_multi <- reactiveValues(dat = data.frame(Chemical_Shift=f,Spectrum=z))

# Plot
output$plot_multi <- plotly::renderPlotly({
  
  ggplot2::ggplot(spectrums_multi$dat,ggplot2::aes(Chemical_Shift,Spectrum)) + ggplot2::geom_line(color='blue') + 
    
    ggplot2::coord_cartesian(xlim = ranges_multi$x, ylim = ranges_multi$y, expand = FALSE) + ggplot2::scale_x_reverse() +
    
    ggplot2::theme(axis.text.x = ggplot2::element_text(size = 12, color = "#000000"),
                   axis.text.y = ggplot2::element_text(size = 12, color = "#000000"),
                   title = ggplot2::element_text(face = "bold", color = "#000000", size = 17),
                   axis.title = ggplot2::element_text(face = "bold", color = "#000000", size = 15)
    ) +
    
    ggplot2::labs(x = "Chemical Shift", y = "Intensity")
  
})

}

shinyApp(ui = ui, server = server)
`
@yutannihilation
Copy link
Member

Duplicate of #4021.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants