[R] Help needed in plotting 2d histogram

Saikat Dutta Chowdhury saikatduttachowdhury at gmail.com
Fri Dec 18 04:52:41 CET 2015


Hello.
I have more than one phi-psi time series data files each having 50000 time
points.
I am trying to create density plots (2d histograms) for each and then I
would like to compare them. But to be able to compare one plot with the
other I need to have similar colour densities (i.e colour gradient (which
depends on counts) will be same for each). But I am unable to control the
colour gradient and thus unable to compare the plots.

I was using ggplot2 library. After getting the phi-psi data into R I was
doing the following steps:


*df <- data.frame(phi[,2],psi[,2])*

*p <- ggplot(df,aes(phi[,2],psi[,2]),ymin=c(-180,180),xmin=c(-180,180))*
*p + stat_bin2d(bins=100)*

after executing these steps I am getting the density plot with the colour
gradient legend at the left side with a certain range (say 0-200). I want
to control this colour gradient parameter so that I can fix this range to
0-600 for all the plots and thus be able to compare them.

Any help would be appreciated.

With regards,
-- 
Saikat Dutta Chowdhury
Research Fellow
University of Calcutta
India
Mobile: 8017650842

	[[alternative HTML version deleted]]



More information about the R-help mailing list