[R] histogram break width
David Winsemius
dwinsemius at comcast.net
Thu Mar 29 16:36:21 CEST 2012
On Mar 29, 2012, at 10:12 AM, Sarah Goslee wrote:
> See below:
>
> On Thu, Mar 29, 2012 at 10:05 AM, Vihan Pandey
> <vihanpandey at gmail.com> wrote:
>> Hi all,
>>
>> I am generating histograms with the following R script :
>>
>> #!/usr/bin/Rscript
>>
>> out_file = "histo.png"
>> png(out_file)
>>
>> scan("values.csv") -> myvalues
>> hist(myvalues, breaks = 50)
>>
>> dev.off()
>>
>> print(paste("Plot was saved in:", getwd()))
>>
>>
>> I want the histogram to have a larger number of breaks, but a smaller
>> break width, the idea is to make it appear smoother like a filled
>> curve. If I keep increasing breaks it starts looking messy. Any
>> suggestions?
>
> Get better data?
> Use a different type of plot, like a filled curve maybe?
>
> If a histogram isn't meeting your needs, then use something else.
Right. Possibly:
?density
?plot.density
Although Sarkar's lattice implementation of panel.violin is
aesthetically superior to my mind.
--
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list