[R] Drawing circles on a chart

Gabor Grothendieck ggrothendieck at gmail.com
Wed Nov 3 04:25:45 CET 2010

```On Tue, Nov 2, 2010 at 10:58 PM, Santosh Srinivas
<santosh.srinivas at gmail.com> wrote:
> Thanks Gabor. I used melt to transform the data and plot using balloonplot.
>
> tData <- structure(list(A = c(0.2, 0.13, 0.05, 0.1, 0.02, 0.18, 0.09, 0.06,
>  0.13), B = c(0.15, 0.06, 0.09, 0.02, 0.03, 0.12, 0.01, 0.15, 0.06), C
>  = c(-0.1, 0, -0.07, -0.06, -0.05, -0.05, -0.06, -0.08, -0.07), D =
>  c(-0.15, -0.05, -0.1, -0.03, -0.13, -0.04, -0.1, -0.04, -0.15), E =
>  c(-0.17, -0.16, -0.08, -0.07, -0.09, -0.14, -0.1, -0.05, 0)), .Names =
>  c("A", "B", "C", "D", "E"), class = "data.frame", row.names = c(NA,
>  -9L))
>
> tData\$Period <- rownames(tData)
>
> tData.m <- melt(tData)
>
> # need to find a way to adjust the color for -ve values
> balloonplot(tData.m\$Period,tData.m\$variable,abs(tData.m\$value))
>

You can also try fixing up this where TS is dput object:

mat <- as.matrix(TS)
plot(col(TS) ~ row(TS), cex = 5 * (mat - min(mat)) / diff(range(mat)),
col = 1 + (mat > 0))

--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

```