Skip to content

How to change width of bar when there are very few bars?

7 messages · michael.weylandt at gmail.com (R. Michael Weylandt, Manish Gupta, Jim Lemon +1 more

You can supply a width argument but you also need xlim if I remember right for the specification to have visible effect. 

Michael
On May 25, 2012, at 2:03 PM, Manish Gupta <mandecent.gupta at gmail.com> wrote:

            
#
If i assign a vector with same small width for each bar (here) still both are
same broad. I think it takes ratio for whole area.  Is there any other
parameter to control it.? Any working example will help me. 



--
View this message in context: http://r.789695.n4.nabble.com/How-to-change-width-of-bar-when-there-are-very-few-bars-tp4631371p4631427.html
Sent from the R help mailing list archive at Nabble.com.
#
On 05/26/2012 12:26 PM, Manish Gupta wrote:
Hi Manish,
If you are using the "barplot" function, you probably want to specify 
both "width" and "space". If you just want to specify a single number, 
look at the "barp" function in the plotrix package, where "width" is the 
parameter that controls the width of the bar as a proportion of the 
distance between bar centers. Note that you won't get different bar 
widths with barp.

Jim
1 day later
#
On 05/28/2012 02:44 AM, Manish Gupta wrote:
Hi Manish,
The sad fact is that I haven't gotten around to coding it yet.

Jim
#
Dear jim and rest of R users,
I initially had the following data set

01.01.1967 0.87
02.01.1967 0.87
03.01.1968 0.87
04.01.1968 0.87
05.01.1969 0.87
06.01.1969 0.87
07.01.1970 0.87
08.01.1970 0.87
09.01.1971 0.87
10.01.1971 0.87
11.01.1972 0.87
12.01.1972 0.87
13.01.1973 0.69
14.01.1973 0.70
15.01.1974 0.71
16.01.1974 0.72




I wanted to reshape it in the following FORMAT

1967 1968 1969 1970 1971 1972 1973 1974
1 0.87 0.87 0.87 0.87 0.71
2 0.87 0.87 0.87 0.87 0.72

with your help, by using following coding, I managed to 
convert it into desired format.
# extract years from the dates
qmu$year<-as.numeric(sapply(strsplit(as.character(qmu$V1),"[.]"),"[",3))
# get a vector of the unique years
uyears<-unique(qmu$year)
# make an empty list
newqmu<-list()
# populate the list year by year
for(i in 1:length(uyears)) 
newqmu[[i]]<-qmu$V2[qmu$year==uyears[i]]

Now, Is there a way to plot, simultaneously, the values of 
each list (which contains data of each year) against its 
respective number of days, by using just a single command? 
As you know that I have problem of leap year in my data 
set, I therefore can?t rely on using a data set of 365 
days and apply it to all the lists.
Your help will be highly appreciated.
Regards
uzair