Generating a fancy dotplot with R - r

i really like the dotplot function in clusterprofiler package. For some reasons related to the object this program creates by itself i cannot replicate this graph with my data.
So my question is, could someone point me to a similar dotplot package/function for achieving the same plot?
Its important to me to show that some of these "biological processes" are present in some clusters (x-axis) ad not in other, and that the colour of the dot is representing its importance (fold). The size of the dot would be represented by an integer.
here the data example i want to show.
thanks in advance.
biological process cluster1-fold cluster2-fold cluster3-fold cluster1-num cluster2-num cluster3-num
cell cycle 0 3 5 0 23 24
dna replication 4 2 0 43 22 0
here the plot i want to replicate

Related

Plotting symbolic functions in OCTAVE

I am new to Octave and was practising trying to represent the function y=e^(-t) as a Fourier series. When I use a series of three terms I get this plot
Plot with 3 terms
However, when I start adding more terms, the plot shows discountinuities.
Plot with 5 terms
Any ideas? Thanks
clear all
t0=0;T=3;w=2*pi/T;
syms t
x=exp(-t);
ezplot(x,[t0 t0+T])
title('')
hold
for k=-2:2
a(k+3)=(1/T)*int(x*exp(-j*k*w*t),t,t0,t0+T);
ex(k+3)=exp(j*k*w*t);
end
xx=sum(a.*ex);
ezplot(xx,[t0 t0+T])
title('')
axis([0 3 0 1.3])

how to plot non-standard contour plots in R (or Matlab)

I would like to plot in R following contour plots representing two dimensional cumulative distributon functions (CDF)
A CDF in 2 or more dimensions is not unique (Lopes et al. The two-dimensional Kolmogorov-Smirnov test) that's why there are 4 alternative plots (and probably some more).
So far I have no R/Matlab code to show. I don't think it's difficult but most likely very time consuming. There might out there something I could use.
EDIT
Type 1 & 4 are more or less covered, but any help with 2 & 3 would be really appreciated.
EDIT2
Types 2 & 3 using geom_rect - as simple as it gets!
The sequence of recangles is ordered wrt the eucleadian distance of the data. This means, if we assume this generic ordering, there is possibly only one version of defining a 2D CDF instead of two. That would confirm the statement of Lopes et al.and other that there are only 2^N-1 (here 3) ways to define the CDF.
Any thoughts?

Retain relationship between x and y data values in R plots

I'm fairly new to R but I am trying to create line graphs that monitor growth of bacteria over the course of time. I can successfully do this but the resulting graph isn't to my satisfaction. This is because I'm not using evenly spaced time increments although R plots these increments equally. Here is some sample data to give you and idea of what I'm talking about.
x=c(.1,.5,.6,.7,.7)
plot(x,type="o",xaxt="n",xlab="Time (hours)",ylab="Growth")
axis(1,at=1:5,lab=c(0,24,72,96,120))
As you can see there are 48 hours between 24 and 72 but this is evenly distributed on the graph, is there anyway I can adjust the scale to more accurately display my data?
It's always best in R to use data structures that exhibit the relationships between your data. Instead of defining growth and time as two separate vectors, use a data frame:
growth <- c(.1,.5,.6,.7,.7)
time <- c(0,24,72,96,120)
df <- data.frame(time,growth)
print(df)
time growth
1 0 0.1
2 24 0.5
3 72 0.6
4 96 0.7
5 120 0.7
plot(df, type="o")
Not sure if this produces the exact x-axis labels that you want, but you should be free to edit the graph now without changing the relationship between the growth and time variables.
x=data.frame(x=c(.1,.5,.6,.7,.7), y=c(0,24,72,96,120))
plot(x$y, x$x,type="o",xaxt="n",xlab="Time (hours)",ylab="Growth")

Box plot in r: 3 time points, 2 treatments with 2 factors on the same graph

I would like to show a simple box plot of data from 3 time points (0, 7 and 28) against abundance. I want to split the plots into treatment (i.e. CO2 level/Temperature) which will be nested within. Essentially I have 2 box plots per time point indicating the 2 different treatments. I Was going to use an overlay but because I have 2 box plots for each time point I am finding it tricky to work out the correct code.
Thanks

R language - heat maps

I'm trying to build a heat map using R. I have a matrix of values (percentage) like:
<p>0 5 0 0 25 30</p>
<p>0 0 0 10 0 0</p>
<p>10 15 65 65 70</p>
and so on.
What I want to get - a heat map where the same values (across the whole matrix) would be represented by the same colour. But I still get a map where the colour for the zero value in the first row differs from the colour for the zero value in the second row etc.
Command that I used to build a heat map is:
my_heatmap <- heatmap(my_heat_matrix, Rowv=NA, Colv=NA, col = colors_01, margins=c(5,10))
UPD: Sorry, I found an answer.
I think you should try the scale="none" argument.
A reproducible example would have been helpful ...
z <- outer(1:10,1:10,"+")
heatmap(z,Rowv=NA,Colv=NA)
heatmap(z,Rowv=NA,Colv=NA,scale="none")
heatmap may qualify as the most annoying R graphics function because of its use of layout, which makes it impossible to arrange the plots on the page in any sensible way ... (filled.contour and the plots from the hexbin package share similar annoyances).

Resources