snsplot in Rshiny through images using reticulate
0
0
Entering edit mode
5 months ago

Hi,

I'm using renderImage to show plots in a webpage based on the user input. But I see the plots are overlapping.

 output$dist_plot = renderImage({
    db <- data()
    var = input$selected_gene
    data_gene <- as.numeric(data.frame(db[db$gene == var,-1]))
    sns$set_style('darkgrid')
    sns$distplot(data_gene)
    plt$savefig('Dist_plot.png')
    list(src = 'Dist_plot.png')
  },deleteFile=FALSE)
}

Attached image: ouput

I also tried creating a png file

output$dist_plot = renderImage({
    db <- data()
    var = input$selected_gene
    data_gene <- as.numeric(data.frame(db[db$gene == var,-1]))

    Dist_plot <- tempfile(fileext = '.png')

    png(Dist_plot)
    sns$set_style('darkgrid')
    sns$distplot(data_gene)
    dev.off()
  },deleteFile=TRUE)
}

This gives me an error $ operator is invalid for atomic vectors

Could someone help resolve this issue? Thanks in advance.

Vinisha

renderImage reticulate rshiny R • 138 views
ADD COMMENT

Login before adding your answer.

Traffic: 1771 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6