Displaying 12 results from an estimated 12 matches for "colramp".
2010 Feb 25
1
Updating a hexbinplot
Dear all,
Considering this simple example of hexbinplot:
mixdata <-
data.frame(x = c(rnorm(5000), rnorm(5000,4,1.5)),
y = c(rnorm(5000), rnorm(5000,2,3)),
a = gl(2, 5000))
fig <- hexbinplot(y ~ x | a, mixdata)
print(fig)
update(fig, colramp = BTC)
produces a bad (non-updated) legend. Compare it with:
hexbinplot(y ~ x | a, mixdata, colramp = BTC)
What should I do to update the plot with the correct legend?
(I'm using R 2.10.1 under Windows XP).
Thanks in advance,
Marcin
2012 Dec 16
3
xlim/ylim problem
...st_hits, rownames.force = NA)
All<-merge(numerical1, numerical2, all=TRUE)
library(hexbin)
bin<-hexbin(All, xbins=100)
# The next line works pretty good, but there is one extrem artefact in the
data, which let collaps all the data to a small area #
plot(bin, main="All",colramp=function(n){heat.ob(n,beg=230,end=25)})
# So I tried to scale my yaxes, with the next line:
#plot(bin, main="All",ylim=(0,15000),
colramp=function(n){heat.ob(n,beg=230,end=25)})
# The following error message is displayed:
#Fehler: Unerwartete(s) ',' in "plot(bin, ma...
2008 Aug 14
1
Graphing: plot 3rd variable based on color gradient
Hello,
I am searching for the best method to plot two variables with points
whose output color depends on the size of a third variable. For
example, the darkness of the x-y point would increase incrementally
based on the size of the z value, similar to the colramp parameter in
geneplotter. This would be analagous to symbols(), except changing the
selection from the color gradient rather than the size of the plotted
shape. The closest I have come so far is the levelplot() function, as
below:
graphdata <- alldata[,c("x","y", "size&...
2010 Nov 19
1
Color Alaska in USA map
...)
state
range<-with(state,range(state[1:3,3]))
range
nbreaks=6
breaks<-do.breaks(range,nbreaks)
StateName<-state[1:3,1]
StateName
mapplot(StateName~state[1:3,3],data=state,breaks=breaks,
map=map("world", c("USA", "Hawaii"), fill=TRUE) ,scales=list(draw=FALSE),
colramp = colorRampPalette(c("white", "black")),xlab=NULL)
After I run this code, the continental USA could be colored, but alaska is not colored. I have tried to write alaska as "Alaska" and "USA:alaska". However, it does not work. Do you have any suggestion? Than...
2010 Jul 08
1
Brewer.pal error
...have been working since I exit from University. I have
returned to make a phd...I´m fortunatelly I´m working so unfortunatelly I
have few time to study (I have also a baby with 16 months).
I´m trying to use R but sometimes it gets very difficult.
I´m trying to put this code in my polygon function
colramp=colorRampPalette(brewer.pal(9,"YlOrRd")
to use brever.pal I have installed this lybrary
library(“RColorBrewer”)
but when I try to run it appears this message:
Error in col2rgb(colors) : cannot find function "brewer.pal"
If you want I can attach the zip I use.
Can anyone pl...
2008 Mar 14
1
smoothScatter
...wer")
x1 <- matrix(rnorm(1e4), ncol=2)
x2 <- matrix(rnorm(1e4, mean=3, sd=1.5), ncol=2)
x <- rbind(x1,x2)
layout(matrix(1:4, ncol=2, byrow=TRUE))
op <- par(mar=rep(2,4))
smoothScatter(x, nrpoints=0)
smoothScatter(x)
smoothScatter(x, nrpoints=Inf,
colramp=colorRampPalette(brewer.pal(9,"YlOrRd")),
bandwidth=40)
colors <- densCols(x)
plot(x, col=colors, pch=20)
par(op)
But I can't even get the example to work. I have installed geneplotter and RColorBrewer, but I get the messages "
Error: could not find func...
2008 Sep 22
1
SmoothScatter plot range issue
...ut it has no effect on expanding this light blue plot
area. Code is below.
#### xyz is a dataframe containing two columns with corresponding x and y
values
library(geneplotter)
library(RColorBrewer)
layout(matrix(1:1, ncol=2, byrow=TRUE))
smoothScatter(xyz, nrpoints=0, xlim=c(-3,3),
ylim=c(0,5),colramp=colorRampPalette(c("#f8f8ff", "white",
"#736AFF", "cyan", "yellow", "#F87431", "#FF7F00", "red",
"#7E2217")))
###END
Thanks very much for any help,
Jason
[[alternative HTML version deleted]]
2012 Mar 18
1
problem saving gplot.hexbin using file save as pdf - "Error: invalid graphics state
...ab inside gplot.hexbin because it writes over the
numbers on the axis.
The file is 33k records but I could get a subset and paste in here if
people need that to resolve the issue.
the code
par(oma=c(3,3.5,3,1))
par(mar=c(2, 4, 0, 0))
plot.new()
gplot.hexbin(h, style = "colorscale",
colramp = function(n) {LinGray(7, beg=92, end=1)},
colorcut = 8,
xlab = "", ylab = "", main = "",
legend = .75, lcex = .8)
mtext("Outside Temperature (F)", side=1, line = 2, col="black",cex=1.1)
mtext("Electrical Power (kW)", side=2, lin...
2011 Jun 10
1
smoothScatter function question and adding a legend
...darkgreen", "green", "yellow", "orange", "darkorange", "red", "darkred")
> x <- read.table("c:/users/ccolling/log_u1m1.txt", sep ="\t")
> smoothScatter(x$V8~x$V7,
nbin=1000,
colramp = colorRampPalette(c(clayton)),
nrpoints=Inf,
pch="",
cex=.7,
transformation = function(x) x^.14,
col="black",
main="M1 vs. M3 (r = 0.92)",
xlab="Norma...
2011 Dec 22
1
overlaid filled contour plots
...nlevels=4, add=TRUE, col=clr[3])
lines(rbind(cm0, cm1, cm2))
points(rbind(cm0, cm1, cm2), col=clr, pch=16, cex=1.5)
I've tried filled.contour(), as below, except that (a) it doesn't allow
add=TRUE, and (b) has no way to suppress the legend.
# try filled contours, using transparent colors
colramp0 = colorRampPalette(c("white", clr[1]))
col <- paste(colramp0(5), "80", sep="") # make transparent
filled.contour(dest0$x1, dest0$x2, dest0$fhat, nlevels=4,
xlim=c(-8,4), ylim=c(-3,0), cex.lab=1.25, col=col,
xlab="GNP", ylab="Unemployed"...
2012 Jun 13
0
Determining Legend for smoothScatter
Dear all,
I am using the smoothScatter function in base R for a plot -
Lab.palette.both <-
colorRampPalette(c("darkblue","lightblue","red","yellow"), space = "Lab")
smoothScatter(X24fresh.sorted[,c(13,10)], colramp = Lab.palette.both)
I understand that my yellow colored points represent highest density, red
lower, lightblue even lower etc. But how do I obtain a legend with the
actual counts for this figure?
I would really appreciate your help.
Thanks!
Kurinji
Grduate Student
Johns Hopkins University/Univ...
2010 May 14
2
help color coding map in R
I am trying to create a map with selected states based on highest to lowest mean cost. The following code properly selects the correct states, and the legend is properly color coded with ranges, but the colors per range does not match the state colors. I need help getting the state colors to match the ranges outlined in the legend. I have tried ordering the mean amounts and this correctly creates