Displaying 17 results from an estimated 17 matches for "scale_fill_gradient".
2010 Apr 27
1
ggplot2 - help with intervals in geom plot
..., next shade for 10-30, next for 30-70
etc.
Due to some magic done on the data, one uses intervals 0,50,100,150 and
the other 0,20,40 etc. - not important but I would be interested to know
why. My plots are created by;
ggplot(DiffMod,aes(binL,binR,fill=HProbCount)) + geom_tile() +
theme_bw() + scale_fill_gradient(low="white",high="red")
ggplot(DiffMod,aes(binL,binR,fill= HCount)) + geom_tile() + theme_bw() +
scale_fill_gradient(low="white",high="red")
I can get the intervals right in the legend using;
ggplot(DiffMod,aes(binL,binR,fill=HProbCount)) + geom_tile()...
2010 Jan 18
2
ggplot2 histogramm
Hi,
i get no success change the title of the "fill" (colour) legend and the
defintion of "levels". Have anybody a hint how i can do this.
df <-
data.frame(variable=sample(c("A","B","C"),1000,replace=T,prob=c(0.22,0.28,0.5)),group=gl(2,500))
p <- ggplot(df, aes(x = variable))
p + geom_histogram(aes(y= ..count.. /
2008 Jul 08
4
Histogram with colors according to factor
Given a data frame with a continuous variable and a factor. I would like to
generate a histogram of the continuous variable, where each bar is filled
with different colors according to the percentage of factor values falling
into this region of the continuous variable.
I looked into packages like 'lattice' and 'ggplot2'. Searching R-help
revealed that 'histogram' is
2017 Nov 17
2
How to produce rainfall maps
...csv file with lat and lon coordinates)
sites <- data.frame(read.csv(?/your/path/to/pointfile.csv?))
#Now make the map
ggplot(data=df, aes(y=Latitude, x=Longitude)) +
geom_raster(aes(fill=MAP)) +
geom_point(data=sites, aes(x=x, y=y), color=?white?, size=3, shape=4) +
theme_bw() +
coord_equal() +
scale_fill_gradient(?MAP (mm/yr)?, limits=c(0,2500)) +
theme(axis.title.x = element_text(size=16),
axis.title.y = element_text(size=16, angle=90),
axis.text.x = element_text(size=14),
axis.text.y = element_text(size=14),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = ?right?,...
2017 Nov 21
0
How to produce rainfall maps
...sites <- data.frame(read.csv(?/your/path/to/pointfile.csv?))
>
> #Now make the map
> ggplot(data=df, aes(y=Latitude, x=Longitude)) +
> geom_raster(aes(fill=MAP)) +
> geom_point(data=sites, aes(x=x, y=y), color=?white?, size=3, shape=4) +
> theme_bw() +
> coord_equal() +
> scale_fill_gradient(?MAP (mm/yr)?, limits=c(0,2500)) +
> theme(axis.title.x = element_text(size=16),
> axis.title.y = element_text(size=16, angle=90),
> axis.text.x = element_text(size=14),
> axis.text.y = element_text(size=14),
> panel.grid.major = element_blank(),
> panel.grid.minor = element_blank...
2018 Mar 19
1
Labelling a fortified GADM map plotted with ggplot and geom_map
...or of the borders between regions white
size = 0.15) + #sets the thickness of the boarder lines
coord_map("polyconic") + #sets the coordinates to polyconic (rounded lat and long)
scale_fill_gradient(name = "Children Reached", #sets the gradient of the value scale: names the scale
low = grey_2, #color of the low end
high = orange_1) + #color of the high end...
2013 Feb 14
2
Plot a Matrix as an Image with ggplot
Dear all,
I am trying to plot a matrix I have? as an image
str(matrixToPlot)
?num [1:21, 1:66] 0 0 0 0 0 0 0 0 0 0 .
?that contains only 0s and 1s,
where the xlabel will be Labeled as
str(xLabel)
?num [1:66] 1e+09 1e+09 1e+09 1e+09 1e+09 ...
and the yLabels will be labeled as
str(yLabel)
?num [1:21] -88 -87 -86 -85 -84 -83 -82 -81 -80 -79 ...
I have found on the internet that I can do
2012 Apr 01
1
extend data frame for plotting heat map in ggplot2
...if
ggplot can somehow generate it?):
A B value
T1 T2 0.347
T1 T3 0.669
T2 T3 0.214
T2 T1 0.347
T3 T1 0.669
T3 T2 0.214
T1 T1 1
T2 T2 1
T3 T3 1
Then I would run
sorted<-data[order(data$A, data$B), ]
ggplot(sorted, aes(A, B)) +
geom_tile(aes(fill = value), colour = "white") +
scale_fill_gradient(low = "black", high = "red") +
I have solved this, but in (what I assume is) a really bad way involving
for loops. There must be a better way to get form the first data frame
above to the second!
Cheers,
Till
--
Till Bayer
4700 King Abdullah University for Science and T...
2017 Sep 13
0
ggmap + geom_raster
...m=7)
YlOrBr <- c("#FFFFD4", "#FED98E", "#FE9929", "#D95F0E", "#993404")
ggmap(MyMap) + stat_density_2d(data=s_rit, aes(x=lon, y=lat,
fill=..level.., alpha=..level..),
geom="polygon", size=0.01, bins=16) +
scale_fill_gradient(low="red", high="green") +
scale_alpha(range = c(0,0.3), guide=FALSE)
The above computes 2d density but it does not take the score (the weight
into account). To do a weighted KDE I do :
library(ks)
mydensity <- kde(x = s_rit[,c(2,3)],w = s_rit$score)
This computes a wei...
2010 Oct 28
1
Heatmap construction problems
I am very new to R and don't have any computer program experience
whatsoever. I am trying to generate a heatmap of the following data:
Phylum,AI,AJT,BY,GA,Grt,Sm
Acidobacteria,0.5,0.7,2.7,0.1,2.6,1.0
Actinobacteria,33.7,65.1,9.7,2.0,3.9,2.1
Bacteroidetes,9.7,5.6,0.7,13.2,41.1,21.6
CCM11b,0.0,0.0,0.0,0.0,0.0,0.1
Chlamydiae,0.1,0.1,0.0,0.0,1.0,0.2
2017 Nov 22
2
How to produce rainfall maps
...ath/to/pointfile.csv?))
> >
> > #Now make the map
> > ggplot(data=df, aes(y=Latitude, x=Longitude)) +
> > geom_raster(aes(fill=MAP)) +
> > geom_point(data=sites, aes(x=x, y=y), color=?white?, size=3, shape=4) +
> > theme_bw() +
> > coord_equal() +
> > scale_fill_gradient(?MAP (mm/yr)?, limits=c(0,2500)) +
> > theme(axis.title.x = element_text(size=16),
> > axis.title.y = element_text(size=16, angle=90),
> > axis.text.x = element_text(size=14),
> > axis.text.y = element_text(size=14),
> > panel.grid.major = element_blank(),
> > pa...
2008 Jan 18
3
Problems with lattice plot
Hello useRs,
I have some problems when I try to plot a lattice. The lattice has 200
columns (X value) and 5 rows (Y value), with a total of 1000 squares. I
want to plot this lattice with the squares having different colours
according to a variable value.
The variable I want to plot is cover value of a shrub, and it has values
between 0 and 1. I want to plot the squares with value 1,
2013 Mar 14
1
ggplot2 problem
...de, he y values are
in alphabetical order, but I want it in month order.
The code is:
library(reshape)
library(ggplot2)
library(scales)
p <- ggplot(data.m, aes(variable, Month)) + geom_tile(aes(fill = value),
colour = "white")
p + scale_fill_gradient(low = "white", high = "black")
Thank you!
The used data is:
Month variable value
1 Jan 1961 87.6666667
2 Feb 1961 133.6666667
3 Mar 1961 113.6666667
4 Apr 1961 50.6666667
5 May 1961 7.5000000
6 Jun 1961 0.0000000...
2017 Nov 23
0
How to produce rainfall maps
...sites <- data.frame(read.csv(?/your/path/to/pointfile.csv?))
>
> #Now make the map
> ggplot(data=df, aes(y=Latitude, x=Longitude)) +
> geom_raster(aes(fill=MAP)) +
> geom_point(data=sites, aes(x=x, y=y), color=?white?, size=3, shape=4) +
> theme_bw() +
> coord_equal() +
> scale_fill_gradient(?MAP (mm/yr)?, limits=c(0,2500)) +
> theme(axis.title.x = element_text(size=16),
> axis.title.y = element_text(size=16, angle=90),
> axis.text.x = element_text(size=14),
> axis.text.y = element_text(size=14),
> panel.grid.major = element_blank(),
> panel.grid.minor = element_blank...
2012 Mar 02
0
ggplot2 0.9.0
..._colour_brewer
p
* Scales now automatically shrink to what is actually displayed on the plot,
not the underlying data used for statistical transformation. If you want the
old behaviour, supply `shrink = FALSE` to the facetting specification.
(Fixes #125)
* `scale_colour_gradient` and `scale_fill_gradient` now use a colour scheme
with constant hue but varying chroma and luminance. This is better because
it creates a natural ordering inline with the order of the colour values.
FACETS
* Converted from proto to S3 objects, and class methods (somewhat) documented
in `facet.r`. This should make i...
2012 Mar 02
0
ggplot2 0.9.0
..._colour_brewer
p
* Scales now automatically shrink to what is actually displayed on the plot,
not the underlying data used for statistical transformation. If you want the
old behaviour, supply `shrink = FALSE` to the facetting specification.
(Fixes #125)
* `scale_colour_gradient` and `scale_fill_gradient` now use a colour scheme
with constant hue but varying chroma and luminance. This is better because
it creates a natural ordering inline with the order of the colour values.
FACETS
* Converted from proto to S3 objects, and class methods (somewhat) documented
in `facet.r`. This should make i...
2007 Jun 24
2
matlab/gauss code in R
...;t create a legend, unless you tell it what
> > > labels it should use - there's an example at
> > > http://had.co.nz/ggplot2/scale_identity.html. Otherwise, if you have
> > > a continuous scale and you want something that works in black and
> > > white, p + scale_fill_gradient(low="white", high="black") might be
> > > easier.
> > >
> > > Hadley
> > >
> > >
> > >>
> > >> > y$color = factor(y$Fnd)
> > >> > y$color = c("black","darkgray","light...