Displaying 20 results from an estimated 10000 matches similar to: "Plotting two overlapping curves"
2011 Aug 25
1
Bivariate normal regression in R
Hello everyone,
I need to fit a bivariate normal regression model to a dataset where the
same covariate (say, X) influences two separate but correlated responses
(say, Y1 and Y2). So, the bivariate
model would look like :
Y1 = a1 + b1*X + e1
Y2 = a2 + b2*X + e2
where e1 and e2 are error terms which can be correlated. Is there any
package in R which can help me fit this model ? Any help will be
2011 Mar 09
4
Extracting only odd columns from a matrix
Hi,
This might seem like a simple question but at the moment I am stuck for ideas. The columns of my matrix in which some data is stored are of this form:
X1 Y1 X2 Y2 X3 Y3 ... Xn Yn
with n~100. I would like to look at just the X values (i.e. odd column numbers). Is there an easy way to loop round extracting only these columns?
Any help would be appreciated.
2006 Sep 07
1
area between two curves, but one is not continuous
Hello,
I want to colorize the area between two curves, but one of these
curves isn't continuous.
The best solution I found is the 2nd example in the help of polygon,
but how can I get no area filling for the missing data in the 2nd curve.
example:
x1 = c(1:8)
x2 = c(1:8)
y1 = c(1,5,6,1,4,5,5,5)
y2 = c(0,3,3,NA,NA,1,3,4)
plot(x1,y1,type="l")
lines(x2,y2)
for the missing parts I
2012 Mar 01
2
Two plots with two different Y labels
Dear all,
I would like to place into a same plot two plots. Their y values though are different a lot (first series has around -100 y values and the second one slightly over 1). The x value are the same.
I would like to have in the same plot (under the same x,y axis the two plots). Is it possible then to have two y labels, one for example in the left side and an extra y label at the right. Each y
2010 Feb 28
4
Reducing a matrix
I wish to rearrange the matrix, df, such that all there are not repeated x values. Particularly, for each value of x that is reated, the corresponded y value should fall under the appropriate column. For example, the x value 3 appears 4 times under the different columns of y, i.e. y1,y2,y3,y4. The output should be such that for the lone value of 3 selected for x, the corresponding row entries
2011 Jul 06
3
finding the intersection of two vectors
Hi,
Suppose I have two vectors, not necessarily the same length (in fact,
they usually are different lengths): y.1 that has increasing values
between 0 and 1; y.2 that has decreasing values between 1.0 and 0. You
can picture these as being supply (= y.1) and demand (= y.2) curves from
economics. I typically plot these vectors on the same graph against a
common x variable, which happens to
2013 Apr 10
1
Plot two separate curves in R Graphics and R Lattice package
Hi,
How can I plot two curves with distinct x and y vectors? I would like to
join one of them by regular lines and plot the other just by points (no
lines). Can it be done in regular R graphic tools, say "plot" function?
Can it be done in Lattice package, say "xyplot" function?
Thanks,
Miao
My data look like this: two curves with different vector size
x
2007 Oct 19
1
unable to interactively label curves on a plot
Hello all
Simple question for the gurus. I'm trying to interactively label curves
on a single plot. The labcurve() function from Hmisc seems like the way
to do this (?). I just can't seem to get it to work. Toy example:
> x <- 1:10
> y1 <- x^2
> y2 <- 2*x
> plot(x,y1)
> lines(x,y2)
> labcurve(labels=c("curve1", "curve2"),
2002 Aug 01
2
plotting two curves: Why same hight?
R 1.5.1 in a linux machine.
I am plotting two curves with curve ():
sin(x)/10 and sin(x)
together, one below the other one ( using par ( mfrow = c ( 2, 1 ))).
What I have noticed is that both curves have the same height but this
should not be so since the range of values of the first function is
shorter than the one of the second function.
In the description of par I could not find any command
2006 Apr 18
4
how to change legend size in a figure
Dear All,
I am producing a figure with many curves on it. How do I make the legends for all those curves smaller so that it can fit the figure itself? The commands I used for ploting are:
plot(x1,y1,col=1,lty=1)
lines(x2,y2,col=2,lty=2)
...
legend(0.3,0.4,c("name1","name2",...),col=1:20,lty=1:20)
Any tips for making the legend fit the figure will very welcome! Thanks!
Best,
2006 Jun 21
4
help on ploting various lines
Dear All,
I tried to plot a variety of lines(curves) on same figure. What I did is,
plot(x=x1,y=y1)
lines(x=x2,y=y2)
lines(x=x3,y=y3)
...
In my data, the maximum of y1 is much smaller than those maximums of other y vectors. So, in the figure I got, there are some curves which are not complete, I mean, they were cut off at the maximum of y1 at the y axis. Could anybody point out some right
2012 Aug 15
1
shade overlapping portions of circles (or other shapes)
I'm making some illustrations and it would be convenient to
automatically shade the overlapping portions of circles. These
illustrations are for Social Choice theory, a field in political
science and economics. I've wrestled together some examples so you
can see what I mean, but have not mastered the "color overlapping
sections" problem (as you will see):
2012 Sep 21
2
efficient overlapping average curve on original curves
Dear useRs,
my question could be very basic for which i apologize in advance.
Each column of a matrix with dimensions 365 rows and 37 columns was drawn against another matrix of dimensions 365 rows and 1 column. with that i was able to draw 37 curves on the same axis.
now i want to draw an average curve of these 37 curves on the same axis in such a way that all the curves (average and 37
2017 Jun 25
2
Writing my 3D plot function
Hi all,I had a question last week on asking for a function that will help me draw three different circles on x,y,z axis based on polar coordinates (Each X,Y,Z circle are coming from three independent measurements of 1-360 polar coordinates). It turned out that there ?is no such function in R and thus I am trying to write my own piece of code that hopefully I will be able to share. I have spent
2010 Nov 09
3
Row-wise recurive function call
Dear Group,
I have a following dataset:
> a
A B C D
1 22 3 31 40
2 26 31 36 32
3 3 7 49 16
4 24 40 27 26
5 20 45 47 0
6 34 43 11 18
7 48 48 24 2
8 3 16 39 48
9 20 49 7 21
10 17 36 47 10
> dput(a)
structure(list(A = c(22L, 26L, 3L, 24L, 20L, 34L, 48L, 3L, 20L,
17L), B = c(3L, 31L, 7L, 40L, 45L, 43L, 48L, 16L, 49L, 36L),
C = c(31L, 36L, 49L, 27L, 47L, 11L, 24L,
2012 Apr 20
3
Matrix multiplication by multple constants
Dear R helpers
Suppose
x <- c(1:3)
y <- matrix(1:12, ncol = 3, nrow = 4)
> y
[,1] [,2] [,3]
[1,] 1 5 9
[2,] 2 6 10
[3,] 3 7 11
[4,] 4 8 12
I wish to multiply 1st column of y by first element of x i.e. 1, 2nd column of y by 2nd element of x i.e. 2 an so on. Thus the resultant matrix should be like
> z
[,1] [,2] [,3]
[1,] 1
2017 Jun 25
0
Writing my 3D plot function
Please look at what I see in your code below (run-on code mush) to understand part of why it is important for you to send your email as plain text as the Posting Guide indicates. You might find [1] helpful.
[1] https://wiki.openstack.org/wiki/MailingListEtiquette
--
Sent from my phone. Please excuse my brevity.
On June 25, 2017 2:42:26 PM EDT, Alaios via R-help <r-help at r-project.org>
2009 Feb 17
2
Efficient matrix computations
Hi,
I am looking for two ways to speed up my computations:
1. Is there a function that efficiently computes the 'sandwich product' of
three matrices, say, ZPZ'
2. Is there a function that efficiently computes the determinant of a
positive definite symmetric matrix?
Thanks,
S.A.
[[alternative HTML version deleted]]
2008 Sep 17
5
Loop on vector name
[My previous message rejected, therefore I am sending same one with some modification]
I have 3 vectors with object name : dat1, dat2, dat3
Now I want to create a loop, like :
for (i in 1:3)
{
cat(sd(dati))
}
How I can do this in R?
Regards,
2010 Jul 26
2
Concatenate a mix of numbers and letters to create a vector name
Dear all,
I am trying to create a vector name, for example tmax.195012 from tmax., 1950 and 12. Obviously I don't wish to simply type it because the 3 name components are changing in each iteration within a loop. Is there any way of concatenating those 3 components (which are a mixture of numbers and letters)?
Thanks for reading,
Panos