Neal-

Perhaps the following code is a start for what you want.

-tgs

par(mar=c(1,1,1,1),
 oma = c(0,0,0,0),
  mgp=c(1.5,.2,0),
  tcl=0,
  cex.axis=.75,
  col.axis="black",
  pch=16)

Z <- textConnection("
country A1 A2 A3
A 3 4 5
B 6 9 8
C 6 9 5")
ddd <- read.table(Z,header=TRUE)
close(Z)


CountryPcts <- rowSums(ddd[,-1]) / sum(ddd[,-1])

plot.new()
plot.window(ylim=c(0,1),xlim=c(0,1),xaxs = 'i',yaxs='i',las=1)
box()
abline(h = cumsum(CountryPcts),lwd=2)

labxats <- NULL
vlines <- ddd[,-1] / sum(ddd[,-1]) / CountryPcts
vlines <- t(apply(vlines,1,cumsum))
yyy <- c(0,rep(cumsum(CountryPcts),each=2))
yyy <- head(yyy,-1)
for(i in 1:nrow(ddd) ){
xxx <- rep(vlines[,i],each=2)
lines(xxx,yyy,col="red",lwd=3)
labxats[i] <- rev(xxx)[1]
}

labxats <- (labxats + c(0,head(labxats,-1)))/2
labyats <- (cumsum(CountryPcts) + c(0,head(cumsum(CountryPcts),-1)))/2
axis(2,at=labyats,labels = ddd[,1],las=1 )
axis(3,at=labxats,labels = colnames(ddd)[-1],las=1 )


On Thu, Dec 13, 2012 at 6:09 PM, Neal Humphrey <nhumphrey@clasponline.org>wrote:

> Hi all,
>
> I'm trying to figure out a way to create a data graphic that I haven't
> ever seen an example of before, but hopefully there's an R package out
> there for it. The idea is to essentially create a heatmap, but to allow
> each column and/or row to be a different width, rather than having uniform
> column and row height. This is sort of like a Marimekko chart in
> appearance, except that rather than use a single color to represent the
> category, the color represents a value and all the y-axis heights in each
> column line up with each other. That way color represents one variable,
> while the area of the cell represents another.
>
> In my application, my heatmap has discrete categorical data rather than
> continuous. Rows are countries, columns are appliances, and I want to scale
> the width and height of each column to be the fraction of global energy
> consumed by the country and the fraction of energy use consumed by that
> appliance type. The color coding would then indicate whether or not that
> appliance is regulated in that country.
>
> Any ideas how to make such a chart, or even what it might be called?
>
>
> Neal Humphrey
> NHumphrey@clasponline.org
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
>

	[[alternative HTML version deleted]]


