[R] different types graphs

1 view
Skip to first unread message

chinna

unread,
Feb 25, 2010, 3:48:04 AM2/25/10
to r-h...@r-project.org

>library(RODBC)
>ch<- odbcConnect("durga")
> sqlQuery(ch, paste("SELECT * from emp"))
>sqlQuery(ch, ("SELECT * from xyz"))

store revenue year_y
1 bigbazar 787875 2008
2 more 87876 2008

plot(revenue ~ year_y, data=xyz, pch=16)


can i get any diffrent types of graphs like pie charts, bar plots.using plot
commands?

please give me suggestions.
--
View this message in context: http://n4.nabble.com/different-types-graphs-tp1568673p1568673.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-h...@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.

Ivan Calandra

unread,
Feb 25, 2010, 4:01:34 AM2/25/10
to r-h...@r-project.org
Hi!

Here are a few tips to start finding what you need (in R):
apropos("pie")
RSiteSearch("pie")

Try also:
?pie
?barplot

I guess there are hundreds of commands to do every type of graphics, but
you can start there.
The manual "Using R for Data Analysis and Graphics" from JH Maindonald
is also quite good, among many others!

HTH
Ivan

Le 2/25/2010 09:48, chinna a écrit :
>
>> library(RODBC)
>> ch<- odbcConnect("durga")
>> sqlQuery(ch, paste("SELECT * from emp"))
>> sqlQuery(ch, ("SELECT * from xyz"))
>>
> store revenue year_y
> 1 bigbazar 787875 2008
> 2 more 87876 2008
>
> plot(revenue ~ year_y, data=xyz, pch=16)
>
>
> can i get any diffrent types of graphs like pie charts, bar plots.using plot
> commands?
>
> please give me suggestions.
>

______________________________________________

Detlef Steuer

unread,
Feb 25, 2010, 4:08:42 AM2/25/10
to r-h...@r-project.org
On Thu, 25 Feb 2010 00:48:04 -0800 (PST)
chinna <durga...@gmail.com> wrote:

>
> >library(RODBC)
> >ch<- odbcConnect("durga")
> > sqlQuery(ch, paste("SELECT * from emp"))
> >sqlQuery(ch, ("SELECT * from xyz"))
>
> store revenue year_y
> 1 bigbazar 787875 2008
> 2 more 87876 2008
>
> plot(revenue ~ year_y, data=xyz, pch=16)
>
>
> can i get any diffrent types of graphs like pie charts, bar plots.using plot
> commands?
>
> please give me suggestions.

try

demo(graphics) for a start

detlef

Jim Lemon

unread,
Feb 25, 2010, 4:47:48 AM2/25/10
to chinna, r-h...@r-project.org
On 02/25/2010 07:48 PM, chinna wrote:
>
>> library(RODBC)
>> ch<- odbcConnect("durga")
>> sqlQuery(ch, paste("SELECT * from emp"))
>> sqlQuery(ch, ("SELECT * from xyz"))
>
> store revenue year_y
> 1 bigbazar 787875 2008
> 2 more 87876 2008
>
> plot(revenue ~ year_y, data=xyz, pch=16)
>
>
> can i get any diffrent types of graphs like pie charts, bar plots.using plot
> commands?
>
Hi chinna,
You can get all of these and more. What type of plot you want depends
upon what you want to illustrate:

# scatterplot - sprays all the values out with a
# different color for each store
plot(xyz$year_y,xyz$revenue,type="p",
col=as.numeric(xyz$store))
# barplot - shows you the relative positions of
# the stores in different years
# this example was done with the toy data I posted last time
barplot(as.matrix(
reshape(xyz,idvar="Store",timevar="Year",dir="wide")[,2:4])
,beside=TRUE)
legend(8,600000,levels(xyz$Store),fill=c("gray80","gray50","gray20"))
# pie chart - shows the mean revenue for each store
# over all the years sampled - again the previous toy data
pie(by(xyz$Revenue,xyz$Store,mean))

You have to decide on what you want to illustrate unless you are just
producing PlotArt, a new genre in which the artist produces random plots
of financial data to emphasize the meaninglessness of the materialistic
culture in which we pretend that we are happy, but

No, I can't keep a straight face anymore.

Jim

Petr PIKAL

unread,
Feb 25, 2010, 5:31:16 AM2/25/10
to chinna, r-h...@r-project.org
Hi

r-help-...@r-project.org napsal dne 25.02.2010 09:48:04:

>
> >library(RODBC)
> >ch<- odbcConnect("durga")
> > sqlQuery(ch, paste("SELECT * from emp"))
> >sqlQuery(ch, ("SELECT * from xyz"))
>
> store revenue year_y
> 1 bigbazar 787875 2008
> 2 more 87876 2008
>
> plot(revenue ~ year_y, data=xyz, pch=16)
>
>
> can i get any diffrent types of graphs like pie charts, bar plots.using
plot
> commands?
>
> please give me suggestions.

Your installation of R must be broken. I can easily get help pages for

?plot
?pie
?barplot

Regards
Petr

Reply all
Reply to author
Forward
0 new messages