Controlling opacity in bubble_plot

8 views
Skip to first unread message

mountaindude

unread,
Jan 19, 2012, 3:00:21 PM1/19/12
to Deducer
Just found out about Deducer and the spatial add-on today - truly
awesome stuff!
Quite impressive to be able to get up running with real, zoomable data
on proper maps within minutes from starting.

One question though: I am trying to create a heatmap of a dataset
where I have long/lat/value for a few thousand data points. Creating
bubble charts is no problem, but I'd ideally like to do create
heatmaps covering the map with gradually varying colors, maybe doing
something along the lines of
- do a bubblechart
- have alpha-blended bubbles
- normalizing the alpha values and using it to control a palette.

Any ideas/pointers on how to achieve this using Deducer (or R in
general, for that matter). Deducer Spatial seems a very good starting
point though..

thanks,
Göran



Ian Fellows

unread,
Feb 6, 2012, 12:34:38 PM2/6/12
to ded...@googlegroups.com
I think you want colored points rather than bubbles for what you are
trying to do. The GUI does not allow you to set transparency on
points. You can do it in code though with something like:

data(LA_places)
plot.new()
par(mar=c(.5,.5,2.25,.5), oma=c(1,1,1,1))
plot.window(c(-1.3515289593271725E7,-1.2869549578318553E7),c(3787607.625475114,4260905.704606224),
xaxs = 'i', yaxs = 'i')
plot(openmap(c(35.71083783530009,-121.409912109375),c(32.18491105051798,-115.609130859375),7,'osm'),add=TRUE)

var <- LA_places@data[,'ID']
var <- round(100*(var+min(var))/max(var))
clrs <- heat.colors(100,alpha=.1) #set alpha here
var <- clrs[var]
x <- coordinates(LA_places)[,1]
y <- coordinates(LA_places)[,2]
points(x,y,col=var)
title('')

Reply all
Reply to author
Forward
0 new messages