Displaying 20 results from an estimated 20000 matches similar to: "histogram plot spacing problem"
2013 Jan 15
1
Histogram plot spacing
Dear all,
I'd like to remove the space between the x-axis and the 0 of the y-axis in the hist function.
I saw the previous post https://stat.ethz.ch/pipermail/r-help/2012-September/324177.html suggesting adding the x-axis at position 0 (or the lowest value of y) after making the histogram. Unfortunately, it doesn't work in my case as I want to use it with a histogram with a ylim starting
2011 Aug 02
1
Need to compute density as done by panel.histogram
Hi,
This might be a simple problem but I don't know how to calculate a random
variable density the way panel.histogram does it before it creates the
actual density rectangles. The documentation says that it uses the density
function but the actual code suggests that the hist.constructor function
(which does not seem to be easily accessible).
Any suggestion for computing the density values of
2005 Feb 09
2
Histogram Bar Spacing or Border Width
Is there any way to control the spacing between bars in a histogram, or
change the border width (I'm assuming the hist() function, though
alternatives are welcome)? I'm interested in changing the visual spacing
between columns in a plotted histogram.
The general effect I'm looking for can be accomplished in barplots using
the "width=" parameter, but I have not been able
2009 Jul 20
3
Histograms on a log scale
Dear All,
I would like to be able to plot histograms/densities on a semi-log or
log-log scale.
I found several suggestions online
http://tolstoy.newcastle.edu.au/R/help/05/09/12044.html
https://stat.ethz.ch/pipermail/r-help/2002-June/022295.html
http://www.harding.edu/fmccown/R/#histograms
Now, consider the code snippet taken from
http://www.harding.edu/fmccown/R/#histograms
# Get a random
2008 May 15
1
lattice histogram problem with integers values and nint
been puzzling over this for a day.
Summary
integer variable to use with histogram, 170,000 rows. Value is day of
year. Hist works, lattice histogram with nint does not work (spurious
spikes in display), lattice histogram using breaks=c(0:365) works
fine. Spike values appear to be sum of two adjacent bins. Want to
know if this is a familiar problem, and what the recommended
work-around is.
2006 Aug 10
2
hist() and bar spacing
Hello,
Could someone explain to me why I get so different histograms, in terms of
bar spacing, depending on the number of counts entered ? (see example below)
> test <- c(0,1,1,1,1,0,0,0,0,0,2,3,2,2,2,3,3,4,5,6,7,5,4,3,4,2,2)
> hist(test)
I obtain this kind of histogram (what I actually want), i.e. large bars with
no space between them
x
xx
xxx
xxxx
xxxxx
xxxxxx
2007 Sep 17
3
Histogram with colors
Is there a simple way to plot a histogram with colors?
For example, suppose I generate random points in the
N(2,1) distribution:
x <- rnorm(100000, mean = 2, sd = 1)
Now I would like to plot the histogram:
hist(x)
but I would like to show the bars with x < 0 in red, and the
bars with x >= 0 in lightgreen. Is there any simple way to
do it?
I think I can do it in two steps:
2004 Aug 19
3
probability histogram question
Hello, all;
I get an unexpected result when trying to plot a probability histogram
with R1.9.1 on windows xp:
#with the following code:
> x <- runif(100,0,1)
> hist(x)
> hist(x, freq=F)
> h <- hist(x, freq=F)
> summary(h)
# Length Class Mode
#breaks 11 -none- numeric
#counts 10 -none- numeric
#intensities 10 -none- numeric
#density 10
2000 Jul 09
1
Modified Histogram functions
Dear all,
I have done further modifications on the histogram functions that I
reported earlier this year, and I hope this can be of use and perhaps
included in the distribution. I have been using this stuff a couple of
months myself, and while it is nothing sophisticated, it has it's
applications. :-) I did a few small modifications today to make it a bit
more compact.
I have modified the
2011 Jun 09
1
histogram - density on y axis and restriction to interval [0, 1]
Hello,
To indicate probability densities instead of counts on a histogram, I
specify freq = FALSE.
However, I expect that summing all top y coordinates over all the
intervals of the histogram will provide 1.
1)
v <- c(0.2885, 0.2988, 0.3139, 0.2615, 0.3179, 0.3163, 0.2583, 0.3052,
0.2527, 0.3147, 0.3235, 0.2408, 0.2480, 0.3108, 0.3577, 0.2829, 0.2694,
0.3275, 0.3314, 0.2639, 0.3076,
2005 Jun 13
3
Lattice: Combining xyplot and histogram
Dear all,
I am trying to create a lattice plot which consists of 1 xyplot and 2
histograms (each for x and y).
My first try was like this:
x<-rnorm(1000)
y<-rnorm(1000)
xy <- xyplot(y~x)
hist.x <- histogram(x)
hist.y <- histogram(y)
print(xy, position=c(0, 0.2, 1, 1), more=TRUE)
print(hist.x, position=c(0, 0, 1, 0.33),more=T)
print(hist.y, position=c(0.8, 0, 1, 1))
Ok, this is
2004 Jul 20
1
Histogram without common borders
Is it possible to produce a histogram directly using the hist()
function with the common borders removed?
It can be done by plotting the histogram object using type 's'teps.
my.hist <- hist(x,plot=FALSE)
plot(my.hist$breaks,c(0,my.hist$counts),type='s')
I would appreciate help
Ross Darnell
--
University of Queensland, Brisbane QLD 4067 AUSTRALIA
Email: <r.darnell at
2009 Apr 22
1
converting histogram to barchart
Hi list,
After a lot of tweaking i have managed to create a histogram with an
overlaying density plot. The histogram shows a sample of birth weights
of babies and the density plot shows birth weights from a much larger
reference populaton. My data is divided in 0.1 Kg bins so in the code
below binweigh=0.1.
The trouble with the current graph is that it is not very clear since
the density plot
2011 May 24
1
histogram with density
Hello All,*
*I want to draw a histogram with density curve. *
*For that simply i created a data called*"x" *and i used the function called
* hist(x, col = "blue", freq = FALSE),** *from this function i got a
histogram*.
*After that , i tried this function* ** lines(density(x), col = "red", lwd
= 2 ) *but i could not get the density curve.
So, Again i used
2011 Dec 31
1
Histogram omitting/collapsing groups
I have two large datasets (156K and 2.06M records). Each row has the
hour that an event happened, represented by an integer from 0 to 23.
R's histogram is combining some data.
Here's the command I ran to get the histogram:
> histinfo <- hist(crashes$hour, right=FALSE)
Here's histinfo:
> histinfo
$breaks
?[1] ?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9 10 11 12 13 14 15 16 17 18 19 20 21
2011 Nov 04
3
barplot as histogram
Hello:
I'm dealing with an issue currently that I'm not sure the best way to
approach. I've got a very large (10G+) dataset that I'm trying to create
a histogram for. I don't seem to be able to use hist directly as I can
not create an R vector of size greater than 2.2G. I considered
condensing the data previous to loading it into R and just plotting
the frequencies as a
2011 Aug 31
2
Getting the values out of histogram (lattice)
Hi,
?
I have a relatively big dataset and I want to construct
some histograms using the histogram function in lattice. One thing I am
interested in is to look at differences between density and percent. I know I can
use the hist function but it seems that this function gives sometimes some
wrong answers and the density is actually a percent since it is calculated as counts in the bin divided by
2008 Jul 17
3
Histogram with two colors depending on condition
Dear List,
Say, we generate data like this-
dat<-rnorm(1000,1,2)
hist(dat)
How do i make the histogram, say, red (col = 2) before X = dat = 0, and rest say, green (col = 3) beyond X = dat = 0 in R?
The resulting histogram could be like this http://ehsan.karim.googlepages.com/histogram.JPG (edited)
Thanks in advance.
Ehsan
http://ehsan.karim.googlepages.com/diaryofastatistician
2012 Dec 03
3
Histogram plot help
Dear All:
I plotted a histogram with Abline, clipping with color codes but i run into
some problems. The "abline' does not show up at all, and when i request
the 'prob=True' (to obtain the freqs), my clipped region colors the section
of the graph instead of the plot only.
Is there any way i can get the y-axis figures to be in whole numbers rather
than decimals?
Many thanks
2007 Dec 30
1
Histogram with different colors for different portions
Dear Rusers,
I would like to color different sections of a histogram different colors.
I have an example that was done by "brute force" given below. Has anyone
implemented something like this in general? If not, any suggestions/pointers
on how to write a general function to do so would be most appreciated.
Alan-