Categories
Uncategorized

Stacked Bar graph and line graph – R

Main data is stored in df, which will be the data for the bar graph, and returns

           V1      V2      V3      ...
periphery  0.659   0.626   0.720   ...
middle     0.250   0.279   0.819   ...
core       0.091   0.077   0.093   ...

then enter GINI coefficients

gco<-c(0.7,1.9,3.1 ... )

draw both bar and line graph

barplot(df,axisnames=FALSE)

we then get the x coordinates for the line graph

bgrp<-barplot(df)

and finally, we draw the line with bgrp as the x coordinates, and gco as the y coordinates

lines(bgrp,gco)

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s