two y-axis in xy-plot

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

two y-axis in xy-plot

Antje Schüle
Hi there,

 

I am wondering if it is possible to do an xyplot with two y-axes. I'd like to print two parameters in a time series but they both have different scales.

 

Which parameter in xyplot can I add to achieve this result?

 

Thanks a lot for any help.

 

Antje


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: two y-axis in xy-plot

Deepayan Sarkar
On 1/9/06, Antje Schüle <[hidden email]> wrote:

> Hi there,
>
>
>
> I am wondering if it is possible to do an xyplot with two y-axes. I'd like
> to print two parameters in a time series but they both have different
> scales.
>
>
>
> Which parameter in xyplot can I add to achieve this result?

The answer depends on the details of what you are doing, so please
provide us with a reproducible example.

Deepayan

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: two y-axis in xy-plot

Antje Schüle
In reply to this post by Antje Schüle

It is nearly the same example I wrote about in http://www.mail-archive.com/r-help@.../msg54238.html. I'll print it out again:

In the first column I have numbers from 0 to 23 (hours of a day), the second
column contains the name of a weekday (Day as factor) and the third column
contains the number I am interested in. So as an example, the first five rows look like that:

     Hour Day Freq

1     0  Mo    23

2     1  Mo    20

3     2  Mo    14

4     3  Mo    27

5     4  Mo    26

 
To read: On Monday between 0 and 1 o'clock 23 things happened.

Now I add a new parameter, so that the data looks somehow like that:

     Hour Day Freq Freq2

1     0  Mo    23  874

2     1  Mo    20   476

3     2  Mo    14  201

4     3  Mo    27   912

5     4  Mo    26   172

Now I'd like to have a plot for every weekday containing the two frequencies as a line during the hours.

Is this possible with two y-axes?

Thanks for your help,

Antje




-----Ursprüngliche Nachricht-----
Von: Deepayan Sarkar [mailto:[hidden email]]
Gesendet: Montag, 9. Januar 2006 18:08
An: Antje Schüle
Cc: [hidden email]
Betreff: Re: two y-axis in xy-plot

On 1/9/06, Antje Schüle <[hidden email]> wrote:

> Hi there,
>
>
>
> I am wondering if it is possible to do an xyplot with two y-axes. I'd like
> to print two parameters in a time series but they both have different
> scales.
>
>
>
> Which parameter in xyplot can I add to achieve this result?

The answer depends on the details of what you are doing, so please
provide us with a reproducible example.

Deepayan

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: two y-axis in xy-plot

Antje Schüle
In reply to this post by Antje Schüle

Hi all,

I think there is something I have forgotten to emphasize. I'd like to have an xyplot (with lattice library). A trellis graphic. For every weekday I like to have a graphic with all hours. And inside the graphic there are the two frequencies as lines.  

The problem finally is the use of the xyplot in library(lattice) in combination with the second y-axis.

Thanks.

Antje


-------------------------------------------------------

It is nearly the same example I wrote about in http://www.mail-archive.com/r-help@.../msg54238.html. I'll print it out again:

In the first column I have numbers from 0 to 23 (hours of a day), the second
column contains the name of a weekday (Day as factor) and the third column
contains the number I am interested in. So as an example, the first five rows look like that:

     Hour Day Freq

1     0  Mo    23

2     1  Mo    20

3     2  Mo    14

4     3  Mo    27

5     4  Mo    26

 
To read: On Monday between 0 and 1 o'clock 23 things happened.

Now I add a new parameter, so that the data looks somehow like that:

     Hour Day Freq Freq2

1     0  Mo    23 874

2     1  Mo    20   476

3     2  Mo    14 201

4     3  Mo    27   912

5     4  Mo    26   172

Now I'd like to have a plot for every weekday containing the two frequencies as a line during the hours.

Is this possible with two y-axes?

Thanks for your help,

Antje




-----Ursprüngliche Nachricht-----
Von: Deepayan Sarkar [mailto:[hidden email]]
Gesendet: Montag, 9. Januar 2006 18:08
An: Antje Schüle
Cc: [hidden email]
Betreff: Re: two y-axis in xy-plot

On 1/9/06, Antje Schüle <[hidden email]> wrote:

> Hi there,
>
>
>
> I am wondering if it is possible to do an xyplot with two y-axes. I'd like
> to print two parameters in a time series but they both have different
> scales.
>
>
>
> Which parameter in xyplot can I add to achieve this result?

The answer depends on the details of what you are doing, so please
provide us with a reproducible example.

Deepayan

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: two y-axis in xy-plot

Deepayan Sarkar
In reply to this post by Antje Schüle
On 1/10/06, Antje Schüle <[hidden email]> wrote:

>
> It is nearly the same example I wrote about in
> http://www.mail-archive.com/r-help@.../msg54238.html. I'll
> print it out again:
>
> In the first column I have numbers from 0 to 23 (hours of a day), the second
> column contains the name of a weekday (Day as factor) and the third column
> contains the number I am interested in. So as an example, the first five
> rows look like that:
>
>      Hour Day Freq
>
> 1     0  Mo    23
>
> 2     1  Mo    20
>
> 3     2  Mo    14
>
> 4     3  Mo    27
>
> 5     4  Mo    26
>
>
> To read: On Monday between 0 and 1 o'clock 23 things happened.
>
> Now I add a new parameter, so that the data looks somehow like that:
>
>      Hour Day Freq Freq2
>
> 1     0  Mo    23  874
>
> 2     1  Mo    20   476
>
> 3     2  Mo    14  201
>
> 4     3  Mo    27   912
>
> 5     4  Mo    26   172
>
> Now I'd like to have a plot for every weekday containing the two frequencies
> as a line during the hours.
>
> Is this possible with two y-axes?

Take a look at this thread:

https://stat.ethz.ch/pipermail/r-help/2005-November/081286.html

-Deepayan

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html