Re: [R] Over lay 2 scale in same plot

2010-09-11 Thread Jim Lemon

On 09/10/2010 10:43 PM, mamunbabu2001 wrote:


Hi Josh,
Thanks for your reply. I gave a reply yesterday but found that it was not
posted.
I managed to plot the bar pot and overlay points.

The problem I am facing now is the spread of Y scale. The values I am
plotting
in Y scale are very close. so they look pretty flat. (lowest value 7.5 and
highest
value 8.5 , so if the ranges in y scale is 6-8, 8-10 , the values looks
pretty flat.)
How can I make the spread of Y scale i.e 6.2 - 6.4 - 6.6 -  .. 8.8 - 10
so that
values does not look flat. I have added an image below.


Hi Mamun,
You can get two different scales e.g. 0-10 on the left and 7-9 on the 
right, but you will want to color code the two axes and plots so that 
the viewer knows which plot goes with which scale. If you want to try 
this, look at twoord.plot in the plotrix package.


Jim

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Over lay 2 scale in same plot

2010-09-10 Thread mamunbabu2001

Hi Josh,
Thanks for your reply. I gave a reply yesterday but found that it was not
posted.
I managed to plot the bar pot and overlay points. 

The problem I am facing now is the spread of Y scale. The values I am
plotting
in Y scale are very close. so they look pretty flat. (lowest value 7.5 and
highest 
value 8.5 , so if the ranges in y scale is 6-8, 8-10 , the values looks
pretty flat.)
How can I make the spread of Y scale i.e 6.2 - 6.4 - 6.6 -  .. 8.8 - 10 
so that
values does not look flat. I have added an image below.

http://r.789695.n4.nabble.com/file/n2534370/_GE_and_CN_Combined_Plot_mod.png 

Thanks in advance.

regards,
Mamun
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Over-lay-2-scale-in-same-plot-tp2528661p2534370.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Over lay 2 scale in same plot

2010-09-10 Thread Joshua Wiley
Hi Mamum,

You can look at the ylim argument to plot().  It lets you control the
limits; however, in your example graph, part of the issue is that the
bars have a much higher value, so you could not change ylim too much
(looks like in your example graph you could set it to something like
ylim = c(0, 7) ? ).

Josh

On Fri, Sep 10, 2010 at 5:43 AM, mamunbabu2001 mrashi...@hotmail.com wrote:

 Hi Josh,
 Thanks for your reply. I gave a reply yesterday but found that it was not
 posted.
 I managed to plot the bar pot and overlay points.

 The problem I am facing now is the spread of Y scale. The values I am
 plotting
 in Y scale are very close. so they look pretty flat. (lowest value 7.5 and
 highest
 value 8.5 , so if the ranges in y scale is 6-8, 8-10 , the values looks
 pretty flat.)
 How can I make the spread of Y scale i.e 6.2 - 6.4 - 6.6 -  .. 8.8 - 10
 so that
 values does not look flat. I have added an image below.

 http://r.789695.n4.nabble.com/file/n2534370/_GE_and_CN_Combined_Plot_mod.png

 Thanks in advance.

 regards,
 Mamun
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Over-lay-2-scale-in-same-plot-tp2528661p2534370.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Over lay 2 scale in same plot

2010-09-08 Thread mamunbabu2001

Hi Peng,
Thanks for your reply. I have tried it and it does work fine
apart from one problem. Even though the second data set 
has same length as the first one, the point function seems
to shit all the points towards left side. So the points are not
in concordat  co-ordinates as the bars. Any idea how this can 
be fixed ???

thanks in advace.

regards,
Mamun 
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Over-lay-2-scale-in-same-plot-tp2528661p2531255.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Over lay 2 scale in same plot

2010-09-08 Thread Joshua Wiley
Hi Mamum,

The co-ordinates appear shifted because the bars are not centered at
1, 2, 3, etc.  To give an example:

# Create a barplot
# of the numbers 1 through 10
barplot(1:10)

# Now look at the x axis coordinates of these actual bars
barplot(1:10, plot = FALSE)

# One way to get these coordinates for yourself would be
x - barplot(1:10) # this will plot AND save the object
x # see the coordinates

# This should have the points properly centered with the bars
points(x = x, y = 10:1)

HTH,

Josh

On Wed, Sep 8, 2010 at 6:14 AM, mamunbabu2001 mrashi...@hotmail.com wrote:

 Hi Peng,
 Thanks for your reply. I have tried it and it does work fine
 apart from one problem. Even though the second data set
 has same length as the first one, the point function seems
 to shit all the points towards left side. So the points are not
 in concordat  co-ordinates as the bars. Any idea how this can
 be fixed ???

 thanks in advace.

 regards,
 Mamun
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Over-lay-2-scale-in-same-plot-tp2528661p2531255.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Over lay 2 scale in same plot

2010-09-07 Thread Jim Lemon

On 09/07/2010 02:57 AM, mamunbabu2001 wrote:


Hi Everyone,
I have two different data set in 2 different scale.
I want to plot these two data in the same plot
in their respective scale. So the plot will have 2 different scale.
I have added an image below to show how it should look.
does any bode has any idea how this can be done.

2 different y scale in same plot..??

http://r.789695.n4.nabble.com/file/n2528661/2scale_ovelay.jpg


Hi Mamun,
I could only see one scale (ordinate) on the plot above, but have a look 
at the twoord.plot function in the plotrix package.


Jim

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Over lay 2 scale in same plot

2010-09-07 Thread Peng, C

Modified from Josh's code:

Is this you want to see?

  barplot(-50:50) 
  # add points into the existing plot at the coordinates set by x and y 
  # and use a line to connect them 
  points(x = 1:101, y = seq(from = 30, to = -20, length.out = 101), type =
 l) 
  # add right hand side axis labeled with different scales. You can adjust
 the 
  # labels according to what rule you have based on the original scale of
 left hand side axis.
  axis(4,at=seq(-40,40,20), label=seq(-4,4,2))
 

-- 
View this message in context: 
http://r.789695.n4.nabble.com/Over-lay-2-scale-in-same-plot-tp2528661p2529802.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Over lay 2 scale in same plot

2010-09-06 Thread Joshua Wiley
Hi,

Looking at the picture, I think you are just talking about plotting
two datasets.  Here is an example I made up, that looks sort of like
your picture:

# make a barplot
barplot(-50:50)
# add points into the existing plot at the coordinates set by x and y
# and use a line to connect them
points(x = 1:101, y = seq(from = 30, to = -20, length.out = 101), type = l)

Do you have some sample data you could send us of what you are trying
to plot?  We can give more specific feedback if we have some actual
data to work with.

Hope that helps,

Josh

On Mon, Sep 6, 2010 at 9:57 AM, mamunbabu2001 mrashi...@hotmail.com wrote:

 Hi Everyone,
 I have two different data set in 2 different scale.
 I want to plot these two data in the same plot
 in their respective scale. So the plot will have 2 different scale.
 I have added an image below to show how it should look.
 does any bode has any idea how this can be done.

 2 different y scale in same plot..??

 http://r.789695.n4.nabble.com/file/n2528661/2scale_ovelay.jpg

 Thanks in advance.

 Mamun
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Over-lay-2-scale-in-same-plot-tp2528661p2528661.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.