Re: [R] Thinking about using two y-scales on your plot?

From: Jim Lemon <>
Date: Thu, 03 Apr 2008 20:55:13 +1000

Allen S. Rout wrote:
> ...
> I've got a series of graphs I generate in R to illustrate backup
> activity. These are scaled, primarily, in bytes. But different
> activities have different costs per byte, and I augment the bytes
> scale with dollars.
> So the blue series corresponds to tbe blue dollars scale (and bytes)
> and the green and red points correspond to the green scale (and
> bytes).
> Am I being naughty?
Hi Allen,
If misleading someone is naughty, I guess we've all done that... The difficulty you have is the visual impression that the storage charges are higher than the transfer charges. You are trying to squeeze three dimensions (daily amount of information, daily cost of transfer and daily cost of storage) into two. Because the values are actually plotted against the first dimension and the cost scales are tacked on to that, only in the case where both of the latter dimensions coincide would the visual metric correspond to the numbers. Then you wouldn't have a problem, of course. I would tend to make the visual comparison on the money dimension and add supplementary axes showing the amount of information for each aspect of the cost. Here's a rough example:

# estimate the first two weeks of data
  c(450,700,200,550,550,545,550,550,195,180,555,555,550,550), storGb=c(900,1000,1020,1025,1030,1035,1045,1045,   1050,1050,1050,1055,1060,1065))
# roughly calculate dollars per day
plot(c(ufexch$transdd,NA,0.2),xlim=c(1,14),ylim=c(0.2,400),col="green",   pch=2,log="y",main="Cost of backups",ylab="Dollars/day",xlab="Date",   axes=FALSE,type="b")
points(ufexch$stordd,col="blue",pch=1,type="b") box()


Jim mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Thu 03 Apr 2008 - 09:51:06 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 03 Apr 2008 - 10:30:25 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive