I am sorry for my careless. I forgot implementing the last code
corresponding to setting y-axis. Thanks Mark Leeds and all guys.




2013/1/22 hp wan <huaping....@gmail.com>

> Thanks. This time the x-axis works well but the y-axis is missing.
>
> 2013/1/22 Mark Leeds <marklee...@gmail.com>
>
>> Hi Hp: I decided to use axis because names.arg wasn't working very well.
>> Below is
>> an improvement and I'm sure, given enough effort, it can be improved much
>> more. But
>> atleast below will get you started.
>>
>>
>> breaks=c(-1.55,-1.50,-1.45,-1.40,-1.35,-1.30,-1.25,-1.20,-1.15,-1.10,-1.05,-1.00,-0.95,-0.90,-0.85,-0.80,-0.75,-0.70,
>>
>> -0.65,-0.60,-0.55,-0.50,-0.45,-0.40,-0.35,-0.30,-0.25-0.20,-0.15,-0.10,-0.05,0.00,0.05,0.10,0.15,0.20,0.25,0.30,0.35,0.40,
>> 0.45,0.50,0.55)
>>
>> binstrings <- as.character(breaks)
>>
>> counts=c(287,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,212,2624,2918,0,0,0,75,36317,4963,0,0,2462,0,0,0,0,0,142)
>>
>> percentage=counts/sum(counts)
>> temp <- barplot(percentage,xlab="",space=1.0, axes=FALSE)
>> print(temp)
>>
>> axis(1,labels=binstrings,at=seq(1.5,83.5,2),cex.axis=0.8)
>> axis(2,labels=seq(0,1,0.1),at=seq(0,1,0.1),cex.axis=0.8)
>>
>>
>>
>> On Mon, Jan 21, 2013 at 8:26 PM, Mark Leeds <marklee...@gmail.com> wrote:
>>
>>> Hi: if you mean that you want the labels to be the strings "-1.55",
>>> "-1.50" etc then you
>>> can use the names.arg argument for that. You can create a vector of
>>> character strings
>>>
>>> binstrings = c("-1.55","-1.50", .... )
>>>
>>> or just convert your data to strings using as.character. Then, in the
>>> call to barplot, include names.arg = binstrings. I think that should work.
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Mon, Jan 21, 2013 at 8:16 PM, hp wan <huaping....@gmail.com> wrote:
>>>
>>>> But the x-axis of barplot is still not what I want. The xlab is breaks,
>>>> not -1.55,-1.50,....,0.55.
>>>>
>>>>
>>>> 2013/1/22 Mark Leeds <marklee...@gmail.com>
>>>>
>>>>> Hi Hp: I'm not sure what you want. Below looks slightly better but if
>>>>> you want the x-axis
>>>>> to have better labels, then there is a names.arg argument to barplot.
>>>>> see ?barplot.
>>>>>
>>>>> I don't know what each of the bins represents but if you want to
>>>>> include all of those zeros then I don't think there's any way of getting
>>>>> around the fact that there is so much space in the barplot. Maybe someone
>>>>> else has a suggestion.
>>>>>
>>>>>
>>>>> breaks=c(-1.55,-1.50,-1.45,-1.40,-1.35,-1.30,-1.25,-1.20,-1.15,-1.10,-1.05,-1.00,-0.95,-0.90,-0.85,-0.80,-0.75,-0.70,
>>>>>
>>>>> -0.65,-0.60,-0.55,-0.50,-0.45,-0.40,-0.35,-0.30,-0.25-0.20,-0.15,-0.10,-0.05,0.00,0.05,0.10,0.15,0.20,0.25,0.30,0.35,0.40,
>>>>> 0.45,0.50,0.55)
>>>>>
>>>>>
>>>>> counts=c(287,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,212,2624,2918,0,0,0,75,36317,4963,0,0,2462,0,0,0,0,0,142)
>>>>>
>>>>> percentage=counts/sum(counts)
>>>>> barplot(percentage,xlab="breaks",xlim=c(1,42))
>>>>>
>>>>>
>>>>>
>>>>> On Mon, Jan 21, 2013 at 7:47 PM, hp wan <huaping....@gmail.com> wrote:
>>>>>
>>>>>> Ok, that is no problem.
>>>>>>
>>>>>>
>>>>>> 2013/1/22 Mark Leeds <marklee...@gmail.com>
>>>>>>
>>>>>>> let me look at but it's probably best to send to the whole list
>>>>>>> because there are many
>>>>>>> people on it way more knowledgable than myself. I'm ccing the list
>>>>>>> and hope you
>>>>>>> don't mind. my fault for replying privately initially.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Mon, Jan 21, 2013 at 7:36 PM, hp wan <huaping....@gmail.com>wrote:
>>>>>>>
>>>>>>>> Thanks for your reply!
>>>>>>>>
>>>>>>>>
>>>>>>>> breaks=c(-1.55,-1.50,-1.45,-1.40,-1.35,-1.30,-1.25,-1.20,-1.15,-1.10,-1.05,-1.00,-0.95,-0.90,-0.85,-0.80,-0.75,-0.70,-0.65,-0.60,-0.55,-0.50,-0.45,-0.40,-0.35,-0.30,-0.25-0.20,-0.15,-0.10,-0.05,0.00,0.05,0.10,0.15,0.20,0.25,0.30,0.35,0.40,0.45,0.50,0.55)
>>>>>>>>
>>>>>>>> counts=c(287,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,212,2624,2918,0,0,0,75,36317,4963,0,0,2462,0,0,0,0,0,142)
>>>>>>>> percentage=counts/sum(counts)
>>>>>>>> barplot(percentage,xlab=breaks)
>>>>>>>>
>>>>>>>> The horizontal value (that is xlabe) looks very ugly. I hope it
>>>>>>>> looks like the xlab of hist, that is x axis correspond to breaks.
>>>>>>>>
>>>>>>>> After ?barplot, I also have no idea to implement it.
>>>>>>>>
>>>>>>>> 2013/1/22 Mark Leeds <marklee...@gmail.com>
>>>>>>>>
>>>>>>>>> I'm not sure that I understand but can't you just take the data
>>>>>>>>> and divide it by the sum of the data and plot that ?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Mon, Jan 21, 2013 at 6:36 PM, hp wan <huaping....@gmail.com>wrote:
>>>>>>>>>
>>>>>>>>>> Thanks for your reply.
>>>>>>>>>>
>>>>>>>>>> If I set the probability = FALSE, the column values are
>>>>>>>>>> corresponding to the refrequency (the numbers of values falling in
>>>>>>>>>> intervals). I want the coulumn values are percentage, that is
>>>>>>>>>> x$counts/sum(x$counts).
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>  2013/1/22 Mark Leeds <marklee...@gmail.com>
>>>>>>>>>>
>>>>>>>>>>> Hi: the density integrates to 1 but the actual height of the
>>>>>>>>>>> density at each point is not less necessarily than 1. for what you 
>>>>>>>>>>> want,
>>>>>>>>>>> you should be using probability = FALSE.
>>>>>>>>>>>
>>>>>>>>>>> you can do pnorm(x=0,0,1) to see this.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>  On Mon, Jan 21, 2013 at 5:18 PM, hp wan 
>>>>>>>>>>> <huaping....@gmail.com>wrote:
>>>>>>>>>>>
>>>>>>>>>>>>  Hi All,
>>>>>>>>>>>>
>>>>>>>>>>>> When carrying out hist(samples,breaks=50,probability=TRUE), the
>>>>>>>>>>>> column
>>>>>>>>>>>> values are considerably greater than 1, which seams very
>>>>>>>>>>>> unreasonable. The
>>>>>>>>>>>> plot is attached.
>>>>>>>>>>>>
>>>>>>>>>>>> I think the column value of the hist plot should correspond to
>>>>>>>>>>>> x$counts/sum(x$counts)
>>>>>>>>>>>>    (x=hist(samples,breaks=50,probability=TRUE)). The size of
>>>>>>>>>>>> data is a
>>>>>>>>>>>> little bit larger,  causing failure of uploading. If you need
>>>>>>>>>>>> the data, I
>>>>>>>>>>>> can email it to you.
>>>>>>>>>>>>
>>>>>>>>>>>> Can anyone help me?
>>>>>>>>>>>>
>>>>>>>>>>>> Thanks!
>>>>>>>>>>>>
>>>>>>>>>>>> Best regares,
>>>>>>>>>>>>
>>>>>>>>>>>> Huaping Wan
>>>>>>>>>>>>
>>>>>>>>>>>> ______________________________________________
>>>>>>>>>>>> R-help@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<http://www.r-project.org/posting-guide.html>
>>>>>>>>>>>> and provide commented, minimal, self-contained, reproducible
>>>>>>>>>>>> code.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>

        [[alternative HTML version deleted]]

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

Reply via email to