How do I make gsea plot with group names labelled? - r

I am trying to plot gsea similar to image as given below:
the tutorial does not give you such plots. So I tried the github link.
But it failed to generate the similar plot

I checked both gseaplot2{enrichplot} and plotEnrichment{fgsea} and found no options to automatically add the group names. It might be a good idea to just add the names after exporting to Adobe Illustrator. Would be happy to hear other ideas though if anyone else knows a better way.

Related

How to Change X-Axis Label in ChromoMap?

I am new to R and I have been using chromoMap library in R to visualize annotation plots and visualizing the feature-associated data. It's a great library and produces great charts. However, I was not able to find any option for changing the x-axis label from length (bp) to anything else. Because of this, I am not able to use any of the produced charts. It sounds like a small issue, but it totally affects the usability of this great package. I followed this tutorial link and produced the below chart. In my chart and all the samples, the x-axis label is fixed and this is my problem and I am looking for a way to just change it.
library(chromoMap)
chr_file_1 = "chr_file_without_centromere.txt"
anno_file_1 = "annotation_pos.txt"
chromoMap(chr_file_1,anno_file_1)
I am wondering if anybody has the same experience ?? This package produces output as a htmlwidget object and therefore I could not change the x-axis lable. Is there any way to modify a htmlwidget object? or Any way to change this bp to something else??

Using ggplot to plot a customizable table of data

This idea has been spurred by this work at Five Thirty Eight.
I'm not entirely sure that they used R, but the chart appears in a similar fashion to their other data viz. I looked around here, but couldn't find anything directly relating to this.
Is this kind of plot possible using ggplot?
Thanks for any and all help!
They do use R but their ggplot2 theme is semi-proprietary and they don't say what they use. People have attempted to recreate the theme
https://github.com/jrnold/ggthemes
After the graphs are created it then goes through an illustrative step to bring graphs together and make them more of a story.

Building a heatmap in R with more information

I made a heatmap on R and most of it is one colour. I have two columns of data which showed up as various colours, but the rest of it is red.
Does anyone know how to increase the "resolution" of this? I don't mean anything about how to make the image more clear (which is why I think I'm having trouble searching for info on it). I mean, how do I make my heatmap more meaningful and not all mostly one colour.
Thanks and sorry if this has been answered somewhere else. I think I don't know the key term I need to search properly.
Edit:
Here is the code I used so far (heatdata is my matrix):
heatmap <- heatmap(heatdata,Rowv=NA,Colv=NA,col=cm.colors(256),scale="row")

Mapping variable values to colors in gvisLineChart?

I'm looking for the equivalent of:
ggplot(df,aes(x=date,y=var1,**group=col1,colour=col1**))+geom_line()
in the googleVis package.
Anyone knows how to do this? I only found examples of differently colored lines if they are mapping different columns from the dataframe.
thanks!
#mtoto, I hope my answer here on ggplot2 equivalent of 'factorization or categorization' in googleVis in R can help. Have you taken a look?
Using roles you can specify specific styles for your data. It involves adding another column with the style detail. So if plotting varx, you need to add the column varx.style where you will set the colors.
I do not know ggplot well enough to know if this is the exact fit of what you want, but please take a look at my figures and links in that answer.

SVGAnnotation to create tool tips for each value in R heatmaps

I'd like to create a heat map in R that I want to use on a website. I stumbled upon the SVGAnnotation package which seems to be very nice to process SVG graphics in R to make them more interactive. First, I was planning to add tool tips for each cell in the heatmap - if the user hovers over the cell, the value of this cell should pop up. However, I am fighting with SVGAnnotation for more than 3 hours now, reading and trying things, and I can't get it to work.
I would appreciate any help on the SVGAnnotation tool tip function. But I would also very much appreciate alternatives to SVGAnnotation to add some activity to my R SVG heatmap.
So, what I have got so far looks like this:
library(SVGAnnotation)
data(mtcars)
cars <- as.matrix(mtcars)
map <- svgPlot(heatmap(cars))
addToolTips(map, ...) # problem
saveXML(map, "cars.svg")
My problem is the addToolTips function itself, I guess. Intuitively, I would simply insert the data matrix, i.e., cars, but this does not work and R gets stuck (it's calculating, but doesn't return anything, I waited 50 minutes)
EDIT:
After some more online research, I found a good example of what I want to achieve: http://online.wsj.com/article/SB125993225142676615.html#articleTabs=interactive
This heat map looks really great, and the interactive features (tool tips) work very well. I am wondering how they did that. To me, it looks like the graphic was done in R using the ggplot package.
I wrote a command line tool that can do exactly that if you are still interested to add tool tips to your heat map. It runs in Windows/Linux/MacOS terminals. All you need as input is the heat map as svg file and the data table/matrix that you used as input to create your heat map as csv or other text file.

Resources