How to make line graph from x-axis values versus y-axis values in xcode? - xcode4

How to create x-y graph with x-axis values for example x1,x2,x3 versus y-axis values for y1,y2,y3?

Related

How to add frequency & percentage on the same histogram in R?

Consider the following data set.
x <- c(2,2,2,4,4,4,4,5,5,7,7,8,8,9,10,10,1,1,0,2,3,3,5,6)
hist(x, nclass=10)
I want to have a histogram where the x-axis indicates the intervals & the y-axis on the left represents the frequency. In addition to this, I need another y-axis on the right side of the histogram representing the percentage of the intervals on the same plot. Even though the following graph is for two variables, more or less it looks like what I need (taken from Histogram of two variables in R).
Thanks in advance!
You can add a vertical axis to the right side with axis(4,at = at), where at are points at which tick-marks are to be drawn. If you want the density values of your histogram as tick-marks, call axis(4, at = hist(x,nclass=10)$density).

How to count the number of points below a contour line in R

I've created a heatmap in R based on simulations and plotted it using image.plot() and I have added contour lines by using contour(). I also have a data frame that contains a column for observations in first year and trend size that I have plotted on top of the heatmap using base R plot. Is there an easy way to count the number of points below the 0.5 contour line and about the 0.95 contour line?
Assuming you are plotting a variable called z, you can use something like.
table(z>.95)

R: why is boxplot(x,log="y") different from boxplot(log(x))?

delme <- exp(rnorm(1000,1.5,0.3))
boxplot(delme,log="y")
boxplot(log10(delme))
Why are the whiskers different in this 2 plots?
Thanks
Agus
I would say that in your first plot you just changed the y axis to log, so the values you plot still range between 1 and 10. In this plot the y axis is a log scale. The whiskers on this axis look different because the space between each "tick" (ie axis break) is not constant (there is more space between 2 and 4 than between 10 and 8)
In the second plot, you take the log of the values then plot them, so they range from .2 to 1, and are plotted with a linear y axis.
Look at the summary for both of the normal and log transformed dataframes

How to set range of y axis on stacked barplot crossing the x-axis?

I have a question how to modify stacked barplot crossing the x axis presented here Stacked barplot crossing the x-axis. I want to set yaxis range from eg.-10 to 10. But when I've used ylim(-10,10) negative values appear on the left and scale_y_continuous(labels=abs) doesn't work (like in: http://i.stack.imgur.com/JwgW9.png). How to set range on yaxis and have positive values on both sides from zero?

Changing X-axis position in R barplot

I have two values of averages LR50<-(424.8, 425.7). I want to plot these as a barplot barplot(LR50). Now, I don't need any of the information except from ylim=c(424,426.5). When I change the x-axis axis(1,at=c(0,10), pos=424) there is still bar plot that falls below the axis.
How do I get the barplot to only plot from the new x-axis at y=424 and up?
You will need to use the xpd parameter (and set it to FALSE), this will clip the plot to the plotting region.
barplot(LR50,ylim = c(424,426.5),xpd=FALSE)
axis(1,at=c(0,10),pos=424)

Resources