Skip to content

Support for ggplot stacked bar plots?  #198

Closed
@mrvollger

Description

@mrvollger

I am not sure this is an issue as much as a question as to whether this kind of graph is supposed to be supported. I have a stacked bar plot in ggplot and it does not appear the same way online in ploty. Here is the code and the link to the graph on ploty.

library(ggplot2)
library(reshape2)
library(gtools)
library(scales)
library(dplyr)
library(devtools)
library(plotly)
setwd("/home/mitchell/IW/hmm")

load("mutations.data")
head(mutations)

output:

       chr    pos change ref alt dp ao strain Percentage Mutation                   id
11    chrX 289758    T>G   T   G 49 22  cis--          1  A>C:T>G    chrX289758A>C:T>G
28 chrVIII 204811    A>C   A   C 44 18  cis--          1  A>C:T>G chrVIII204811A>C:T>G
34  chrXII  65829    A>C   A   C 44 19  cis--          1  A>C:T>G   chrXII65829A>C:T>G
40   chrIX 187852    T>G   T   G 37 16  cis--          1  A>C:T>G   chrIX187852A>C:T>G
41    chrV 519341    T>G   T   G 41 17  cis--          1  A>C:T>G    chrV519341A>C:T>G
42   chrVI 113016    T>G   T   G 33 14  cis--          1  A>C:T>G   chrVI113016A>C:T>G
p <- ggplot(mutations, aes(x = strain, fill=Mutation ))
p <- p + geom_bar(stat="identity", position="fill", aes(y=Percentage ))
p <- p + scale_y_continuous(labels = percent_format())
p

Local out put graph:

image

py <- plotly(username="mrvollger", key="aboy5gyo0b")
r<-py$ggplotly(p)
r$response$url

output url:
https://plot.ly/~mrvollger/59

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions