[R] 3D pie
Gabor Grothendieck
ggrothendieck at gmail.com
Wed Apr 19 19:52:01 CEST 2006
Since everyone else wimped out with a tedious you-do-not-want-to-do-that,
here is a solution that uses R to control Excel and create a 3d chart.
You will
need the RDCOMclient package that you can find via google.
library(RDCOMClient)
xl <- COMCreate("Excel.Application") # starts up Excel
xl[["Visible"]] <- TRUE # Excel becomes visible
wkbk <- xl$Workbooks()$Add() # new workbook
# set some cells
sh <- xl$ActiveSheet()
for(i in 1:5) {
lab <- sh$Cells(i,1)
lab[["Value"]] <- letters[i]
val <- sh$Cells(i,2)
val[["Value"]] <- i
}
ch <- xl$Charts()
ch$Add()
ac <- xl$ActiveChart()
xl3DPieExploded <- 70
ac[["ChartType"]] <- xl3DPieExploded
xlColumn <- 2
ac$SetSourceData(Source = sh$Range("A1:B5"), PlotBy = xlColumn)
# now right click the chart and make any other settings you like.
On 4/18/06, COMTE Guillaume <g.comte at alliance-ir.net> wrote:
> Hi all,
>
>
>
> Is there a way to draw 3D pie with R (like excel does)?
>
>
>
> I know how to do it in 2D, just by using pie(something)...
>
>
>
> I know it isn't the best way to represent data, but people are sometimes
> more interested by the look and feel than by the accuracy of the
> results...
>
>
>
> If there is no way, have you another suggestion ? (i already use
> dotchart instead of pie)
>
>
>
> Thks to all of you.
>
> COMTE Guillaume
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
More information about the R-help
mailing list