Displaying 20 results from an estimated 11000 matches similar to: "barplot: space between axis and bars"
2011 Jan 18
2
Barplot and line x-axis positions
Hello all,
Hoping that there is a fairly simple solution to my query...
I'm trying to overlay a line plot of some data onto a barplot of different data. The y-axes are different for each set of data but the x-axes are the same (1:12, corresponding with 12 months of observations). The problem I'm having is that the centre of the bars and the points on line don't match up, which is
2010 Apr 24
2
barplot - offsetting individual bars
Hello,
I'm trying currently using barplot to summarize precipitation data. So far
I've compiled total annual snow and rain accumulation in a table
(attached). I've been successful at plotting it using the following code:
fig=barplot(t(Annual_Precip_table), horiz=TRUE, space=0, col=c("grey70",
"white"), axes=FALSE)
.
.
The result is a stacked barplot with total
2011 Sep 22
2
How to adjust the y-axis range in barplot properly
Hello R-Users,
it might be a rather simple problem I have, but I couldn't find any
solution online. Thus, here is my problem:
I would like to adjust the y-axis range in a barplot, since all my
values are >70. Therefore I would like to only visualize the y-axis from
60-100 (example 1).
The problem is, the range of the y-axis is adjusted, but the barsize
stays the same and vanishes from
2008 Aug 21
2
barplot with anchored bars
Dear R list members,
How to produce barplots anchored to the x-axis (not floating
above the x-axis) with a box around?
With both following codes, the lower horizontal line of the
box is below the y = 0 line:
# first code
x <- c(1,2,3,4)
barplot(x,yaxs='i')
box()
# second code
x <- c(1,2,3,4)
op <- par(yaxs='i')
barplot(x)
box()
par(op)
The parameter yaxs='i'
2007 Sep 25
2
Adjust barplot to the left
Hello,
I have the following problem: I created an ecdf and a barplot. Unfortunatly,
the bars are not where I would like them to be (please see picture below).
http://www.nabble.com/file/p12877530/problem.gif
That's my code:
#------------------------
par(mfrow=c(2,1), mar=c(2,3,3,2))
#ECDF
x = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2)
F2.5 <- ecdf(x)
plot(F2.5,
2011 Apr 04
2
gap.barplot doesn't support data arrays?
I am trying to make a barplot with a broken axis using gap.barplot (in the
indispensable plotrix package). This works well when the data is a vector:
> twogrp<-c(rnorm(10)+4,rnorm(10)+20)
> gap.barplot(twogrp,gap=c(8,16),xlab="Index",ytics=c(3,6,17,20),ylab="Group
values",main="Barplot with gap")
But when the data is an array (for a bar plot with multiple
2010 Sep 09
3
Alignment of lines within barplot bars
Dear all,
I have a barplot upon which I hope to superimpose horizontal lines extending across the width of each bar. I am able to partly achieve this through the following set of commands:
positions <- barplot(bar_values, col="grey")
par(new=TRUE)
plot(positions, horiz_values, col="red", pch="_", ylim=c(min(bar_values), max(bar_values)))
...however this results
2004 Dec 02
1
Gap between axis and bars in barplot()
Hi
Windows XP, R 2.0.1.
I am drawing a very large barplot using jpeg() - setting the width to
10,000 as there are over 5000 bars.
This all works fine and I get exactly what I want - except there is a
huge bit of white space between the Y-axis and the first bar - so much
in fact that I have to scroll two screens from the Y-axis before I see
the first bar. After that the bars are evenly spaced
2016 Apr 25
2
ylim in barplot()
Dear useRs,
I'm having troubles with using ylim in barplot(): even though I reduce
the y-scale using ylim, the bars still extend down to 0into the x-labels.
The sample data is below, and here is the code.
#This works fine but I would like to plot only from 50 to 70:
barplot(t(mydata), beside=TRUE, col=c("orange", "green", "yellow",
"purple"),
2016 Apr 26
1
ylim in barplot()
Thank you David,
That's a nice workaround using plotrix::barp(), but that doesn't explain
why ylim doesn't work as intended (or at least, as I expect it to work),
or why xpd has no influence when using devEMF::emf()...
The problem with saving directly in RStudio is that it requires to
manually save the plot, and this becomes troublesome when there are a
lot of plot commands in a
2016 Apr 25
0
ylim in barplot()
If you are using a Windows system, you can Export the plot from RStudio and save it as a metafile without using package devEMF and it will crop the bars with xpd=FALSE. When I used devEMF on a Windows machine, the bars were not cropped with barplot() as you indicated, but when I switched to plotrix::barp() they were cropped. The arguments are a bit different, but I did not need xpd=FALSE:
2008 Jun 20
5
Plotting barplot and scatterplot on same device - x-axis problem
Hi R-users
I'm a relative newbie and uses R mostly for graphical purpose. I have a
layout problem when plotting a scatterplot and a barplot using
par(new=TRUE). The baseline of the x-axis is not positioned equal for the
two plotting functions (see picture) and I have been unable to find out how
this is changed.
http://www.nabble.com/file/p18025066/pic.jpeg
I have added the script if this
2011 Apr 16
2
Rotating the x-axis labels of a barplot
Dear listserv,
Here is my latest formatting problem. I would like to rotate the x-axis labels
by 45 degrees on a _barplot_. Apparently this is slightly different from the
example given in the R FAQ, which is for rotating the x-axis labels on a
scatterplot
(http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-can-I-create-rotated-axis-labels_003f).
I have adapted that code, as best I could, and
2005 Jan 13
1
Space between bars in barplot
Hi
I am trying to understand the "space" argument to barplot() and I think
it is not working as stated. The docs say:
space: the amount of space (as a fraction of the average bar width)
left before each bar.
Which means that I can pass a vector, the same length as the no. of
bars, and the nth element of that vector will be the space left before
the nth bar. This is
2008 Jul 25
4
Matrix barplot
Hi,
as a bloody R beginner I failed to solve the probably simple problem
to create a barplot of the following data read from a file
Year A B C
2000 4 3 0
2001 2 1 3
2002 1 2 5
The Barplot should look like
5 | C
4 | A C
3 | AB C C
2 | AB A C BC
1 |
2010 Mar 14
6
barplot with a probability density curve
Dear all,
I am making a barplot as following:
barplot(c(1,2,3,5,2,3,1),names.arg=c("100","200","300","400","500","600","700"),xlab="diameter",ylab="flow",main="some title",space=0.1)
I am also trying to add a probability density curve, however using
lines(density(c(1,2,3,5,2,3,1))) does not give
2010 Feb 28
3
Change the scale on a barplot's y axis
I have grades data. I read them from a csv in letter-grade format. I
then converted them to levels
levels(grades$grade)=c('A+','A','A-','B+','B','B-','C+','C','C-','D+','D','D-')
And then to numbers
grades$gp=grades$grade
levels(grades$gp)=c(4.3,4.0,3.7, 3.3,3.0,2.7, 2.3,2.0,1.7, 1.3,1.0,0.7)
2007 Oct 25
4
ploting labels on barplot
Again me.
I want to plot the numbers on the bars of a barplot.
This can be done using hist function when setting the label argument true
(i.e.
data <- c(1,2,3,4)
hist(data, labels=T)
When I try this using barplot I get an error:
> barplot(summary(data), labels=T)
Error in axis(if (horiz) 2 else 1, at = at.l, labels = names.arg, lty =
axis.lty, :
formal
2012 Oct 23
2
barplot
Hi,
I want to make a barplot with the following datasets:
I have a file as following:
name chr position A1 A2 pop1 pop1 pop2 pop2
I have calculated a measure using all the values in columns "pops", the
values are saved in a vector.
Now I want to make a barplot using the values in this vector as the y axis
and the values in the column "position" in the x-axis.
thank you
2012 Sep 03
3
Horizontal grid in background of barplot
All,
I have:
x <- matrix(c(22,3,6,69,9,4,7,81,23,4,22,50),nrow=3,byrow=TRUE)
rownames(x) <- c("Cold or flu","Headache","Backache");
colnames(x) <- c("Went to doctor","No response","Did
nothing","Self-medicated")
x <- t(x)
print(x)
barplot(x,beside=TRUE,
ylim=c(0,90),
xlab="Ailment",