Re: [R] RES: Barplot with "Independent" Lines Y axis

2010-12-11 Thread Rodrigo Aluizio
Well, at least I could help (even if unintentionally), as a
compensation for all the help I got from the list.

Cheers.

Em sexta-feira, 10 de dezembro de 2010, Jim Lemon escreveu:
> On 12/10/2010 08:48 PM, Rodrigo Aluizio wrote:
>
> OK that's it. Working nicely. I sent the final graph with the note of the
> twoord.plot help attached to it. And some "personal" comments
>
>
> Hi Rodrigo,
> Although I came rather late to this, I might as well show how I did it:
>
> # first I corrected the commas as Peter pointed out
> library(plotrix)
> par(las=3)
> twoord.plot(ly=pluv_sal$Rain,lx=pluv_sal$Salt,mar=c(6,4,4,2),
>  xlab="",ylab="Rainfall (mm)",rylab="Salinity",type=c("bar","b"),
>  main="Rainfall and salinity",lcol=NA,rcol=2,
>  xticklab=pluv_sal$Point,xaxt="n")
> par(las=0)
> mtext("Month",side=1,at=7,line=3)
>
> You did find a bug in the twoord.plot function, and the next version of 
> plotrix will contain one more bug fix, with thanks to you.
>
> 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] RES: Barplot with "Independent" Lines Y axis

2010-12-10 Thread Jim Lemon

On 12/10/2010 08:48 PM, Rodrigo Aluizio wrote:

OK that's it. Working nicely. I sent the final graph with the note of the
twoord.plot help attached to it. And some "personal" comments


Hi Rodrigo,
Although I came rather late to this, I might as well show how I did it:

# first I corrected the commas as Peter pointed out
library(plotrix)
par(las=3)
twoord.plot(ly=pluv_sal$Rain,lx=pluv_sal$Salt,mar=c(6,4,4,2),
 xlab="",ylab="Rainfall (mm)",rylab="Salinity",type=c("bar","b"),
 main="Rainfall and salinity",lcol=NA,rcol=2,
 xticklab=pluv_sal$Point,xaxt="n")
par(las=0)
mtext("Month",side=1,at=7,line=3)

You did find a bug in the twoord.plot function, and the next version of 
plotrix will contain one more bug fix, with thanks to you.


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] RES: Barplot with "Independent" Lines Y axis

2010-12-10 Thread Rodrigo Aluizio
OK that's it. Working nicely. I sent the final graph with the note of the
twoord.plot help attached to it. And some "personal" comments
Thank you very much for all the help and remarks.

Rodrigo.

2010/12/10 Dennis Murphy 

> Hi:
>
> Like Peter Ehlers, I'm not a big fan of multiple response variables on a
> page with different y-axis scaling, but if you have to do it, try not to let
> one graphical metaphor interfere with/obscure/dominate the other (e.g., bars
> and lines). This is my attempt, both with connecting lines and points, but
> am holding my nose in the process:
>
> library(plotrix)
> dd <- read.table(textConnection("
>
> Point   RainSalt
> Fev/03  365.6   13
> Mar/03  235 18
> Abr/03  115.1   18
> Mai/03  47.418.75
> Jun/03  112 15
> Jul/03  156.8   17
> Ago/03  66.115
> Set/03  149.8   14
> Out/03  167.1   11.5
> Nov/03  269.3   17.5
> Dez/03  283.7   NA
>
> Jan/04  415 1.3
> Fev/04  322 8.5
> Mar/04  258.7   10.5"), header = TRUE, stringsAsFactors = FALSE)
> closeAllConnections()
>
> dd$mo <- seq(nrow(dd))
>
> with(dd,
>   twoord.plot(lx = mo, ly = Rain, rx = mo, ry = Salt,
>   lylim = c(0, 450), rylim = c(0, 20),
>   lcol = 'red', rcol = 'blue',
>   lpch = 1, rpch = 16, type = c('b', 'b'),
>   xtickpos = mo, xticklab = Point)
> )
> legend('bottomleft', leg = c('Rain (left axis)', 'Salt (right axis)'),
>  text.col = c('red', 'blue'), col = c('red', 'blue'), lty = c(1, 1)
> )
>
> I understand why these types of plots exist in general, and I can see why
> you might want to compare two variables that are temporally related but have
> different units of measurement, but by doing so, you are increasing the
> cognitive task of the average viewer. As Greg Snow mentioned, read the
> section of ?twoord,plot headlined 'Note' and observe that this plot has
> crossing profiles (points connected by lines).  And remember that it's your
> responsibility to properly convey the message of the plot to the viewer...
>
> HTH,
> Dennis
>
> On Thu, Dec 9, 2010 at 2:22 PM, Rodrigo Aluizio wrote:
>
>> Oh sorry. An example say lots more than words. The data below, when
>> submitted to twoord.plot return the mentioned error. Rain are bars and
>> Salt
>> lines, the bars appear and the error occurs with the salt data.
>>
>> Point   RainSalt
>> Fev/03  365.6   13
>> Mar/03  235 18
>> Abr/03  115.1   18
>> Mai/03  47.418.75
>> Jun/03  112 15
>> Jul/03  156.8   17
>> Ago/03  66.115
>> Set/03  149.8   14
>> Out/03  167,1   11.5
>> Nov/03  269.3   17.5
>> Dez/03  283.7
>> Jan/04  415 1,3
>> Fev/04  322 8,5
>> Mar/04  258.7   10.5
>>
>> -Mensagem original-
>> De: Greg Snow [mailto:greg.s...@imail.org]
>> Enviada em: quinta-feira, 9 de dezembro de 2010 17:57
>> Para: Rodrigo Aluizio; 'R Help'
>> Assunto: RE: [R] Barplot with "Independent" Lines Y axis
>>
>> Without seeing a reproducible example we cannot be sure, but my guess is
>> that you are letting twoord.plot set the limits and the function does not
>> remove missing values, if you specify rylim and or lylim arguments
>> specifically, then it should not run into the problem you are seeing (I
>> hope).
>>
>> If that does not work, then send a small reproducible example (the dput
>> command is great for the data part) which will help us find the problem.
>>
>> --
>> Gregory (Greg) L. Snow Ph.D.
>> Statistical Data Center
>> Intermountain Healthcare
>> greg.s...@imail.org
>> 801.408.8111
>>
>>
>> > -Original Message-
>> > From: Rodrigo Aluizio [mailto:r.alui...@gmail.com]
>> > Sent: Thursday, December 09, 2010 12:27 PM
>> > To: Greg Snow; 'R Help'
>> > Subject: RES: [R] Barplot with "Independent" Lines Y axis
>> >
>> > Thank you for the function suggestion, works nicely for complete data
>> > vectors. Just another question. When using the twoord.plot I reached
>> > another
>> > issue, it seems that this function can't handle NAs in one of the
>> > variables
>> > (the data of one month for another variable is missing). The lines and
>> > barplot functions just interrupt the plot and continue after the NA but
>> > twoord.plot gives me an error: Error at plot.window(...) : finite
>> > values are
>> > necessary for 'ylim'
>> >
>> > Is there a way to work around this error?
>> >
>> > P.S.: I'm aware of the problems regarding this type of graph, but this
>> > time
>> > it's not a choice of mine (unfortunately). Thank you anyway for the
>> > highlight, maybe it will help me arguing.
>> >
>> > Regards
>> >
>> > Rodrigo.
>> >
>> > -Mensagem original-
>> > De: Greg Snow [mailto:greg.s...@imail.org]
>> > Enviada em: quinta-feira, 9 de dezembro de 2010 15:56
>> > Para: Rodrigo Aluizio; R Help
>> > Assunto: RE: [R] Barplot with "Independent" Lines Y axis
>> >
>> > Look at the twoord.plot function in the plotrix package, but be sure to
>> > read
>> > the note on the help page, then reread it and take its advice if you
>> > decide
>> > to stick with thi

Re: [R] RES: Barplot with "Independent" Lines Y axis

2010-12-09 Thread Dennis Murphy
Hi:

Like Peter Ehlers, I'm not a big fan of multiple response variables on a
page with different y-axis scaling, but if you have to do it, try not to let
one graphical metaphor interfere with/obscure/dominate the other (e.g., bars
and lines). This is my attempt, both with connecting lines and points, but
am holding my nose in the process:

library(plotrix)
dd <- read.table(textConnection("
Point   RainSalt
Fev/03  365.6   13
Mar/03  235 18
Abr/03  115.1   18
Mai/03  47.418.75
Jun/03  112 15
Jul/03  156.8   17
Ago/03  66.115
Set/03  149.8   14
Out/03  167.1   11.5
Nov/03  269.3   17.5
Dez/03  283.7   NA
Jan/04  415 1.3
Fev/04  322 8.5
Mar/04  258.7   10.5"), header = TRUE, stringsAsFactors = FALSE)
closeAllConnections()

dd$mo <- seq(nrow(dd))

with(dd,
  twoord.plot(lx = mo, ly = Rain, rx = mo, ry = Salt,
  lylim = c(0, 450), rylim = c(0, 20),
  lcol = 'red', rcol = 'blue',
  lpch = 1, rpch = 16, type = c('b', 'b'),
  xtickpos = mo, xticklab = Point)
)
legend('bottomleft', leg = c('Rain (left axis)', 'Salt (right axis)'),
 text.col = c('red', 'blue'), col = c('red', 'blue'), lty = c(1, 1)
)

I understand why these types of plots exist in general, and I can see why
you might want to compare two variables that are temporally related but have
different units of measurement, but by doing so, you are increasing the
cognitive task of the average viewer. As Greg Snow mentioned, read the
section of ?twoord,plot headlined 'Note' and observe that this plot has
crossing profiles (points connected by lines).  And remember that it's your
responsibility to properly convey the message of the plot to the viewer...

HTH,
Dennis

On Thu, Dec 9, 2010 at 2:22 PM, Rodrigo Aluizio  wrote:

> Oh sorry. An example say lots more than words. The data below, when
> submitted to twoord.plot return the mentioned error. Rain are bars and Salt
> lines, the bars appear and the error occurs with the salt data.
>
> Point   RainSalt
> Fev/03  365.6   13
> Mar/03  235 18
> Abr/03  115.1   18
> Mai/03  47.418.75
> Jun/03  112 15
> Jul/03  156.8   17
> Ago/03  66.115
> Set/03  149.8   14
> Out/03  167,1   11.5
> Nov/03  269.3   17.5
> Dez/03  283.7
> Jan/04  415 1,3
> Fev/04  322 8,5
> Mar/04  258.7   10.5
>
> -Mensagem original-
> De: Greg Snow [mailto:greg.s...@imail.org]
> Enviada em: quinta-feira, 9 de dezembro de 2010 17:57
> Para: Rodrigo Aluizio; 'R Help'
> Assunto: RE: [R] Barplot with "Independent" Lines Y axis
>
> Without seeing a reproducible example we cannot be sure, but my guess is
> that you are letting twoord.plot set the limits and the function does not
> remove missing values, if you specify rylim and or lylim arguments
> specifically, then it should not run into the problem you are seeing (I
> hope).
>
> If that does not work, then send a small reproducible example (the dput
> command is great for the data part) which will help us find the problem.
>
> --
> Gregory (Greg) L. Snow Ph.D.
> Statistical Data Center
> Intermountain Healthcare
> greg.s...@imail.org
> 801.408.8111
>
>
> > -Original Message-
> > From: Rodrigo Aluizio [mailto:r.alui...@gmail.com]
> > Sent: Thursday, December 09, 2010 12:27 PM
> > To: Greg Snow; 'R Help'
> > Subject: RES: [R] Barplot with "Independent" Lines Y axis
> >
> > Thank you for the function suggestion, works nicely for complete data
> > vectors. Just another question. When using the twoord.plot I reached
> > another
> > issue, it seems that this function can't handle NAs in one of the
> > variables
> > (the data of one month for another variable is missing). The lines and
> > barplot functions just interrupt the plot and continue after the NA but
> > twoord.plot gives me an error: Error at plot.window(...) : finite
> > values are
> > necessary for 'ylim'
> >
> > Is there a way to work around this error?
> >
> > P.S.: I'm aware of the problems regarding this type of graph, but this
> > time
> > it's not a choice of mine (unfortunately). Thank you anyway for the
> > highlight, maybe it will help me arguing.
> >
> > Regards
> >
> > Rodrigo.
> >
> > -Mensagem original-
> > De: Greg Snow [mailto:greg.s...@imail.org]
> > Enviada em: quinta-feira, 9 de dezembro de 2010 15:56
> > Para: Rodrigo Aluizio; R Help
> > Assunto: RE: [R] Barplot with "Independent" Lines Y axis
> >
> > Look at the twoord.plot function in the plotrix package, but be sure to
> > read
> > the note on the help page, then reread it and take its advice if you
> > decide
> > to stick with this type of plot.
> >
> > --
> > Gregory (Greg) L. Snow Ph.D.
> > Statistical Data Center
> > Intermountain Healthcare
> > greg.s...@imail.org
> > 801.408.8111
> >
> >
> > > -Original Message-
> > > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> > > project.org] On Behalf Of Rodrigo Aluizio
> > > Sent: Thursday, December 09, 2010 9:44 AM
> > > To: R Help
> > > Subject: [R] Barplot with

Re: [R] RES: Barplot with "Independent" Lines Y axis

2010-12-09 Thread Peter Ehlers

On 2010-12-09 14:22, Rodrigo Aluizio wrote:

Oh sorry. An example say lots more than words. The data below, when
submitted to twoord.plot return the mentioned error. Rain are bars and Salt
lines, the bars appear and the error occurs with the salt data.



If you get an error complaining about needing finite ylim values,
then why not supply them?
This worked for me (after fixing your data which contains
several commas where decimal points are needed) and calling
the data frame 'd':

 with(d,
twoord.plot(
  lx=1:14, ly=Rain, rx=1:14, ry=Salt,
  lylim=c(0,450), rylim=c(0,20),
  type=c('bar','b')))

(I had to use with(), because the 'data' argument
in twoord.plot seems not to function as intended.)

I have no idea why anyone would want to use a barplot
for the Rain data, but ...

The above should not be taken as an endorsement of
the production of abominable plots (to which, however,
I am becoming inured).

Peter Ehlers


Point   RainSalt
Fev/03  365.6   13
Mar/03  235 18
Abr/03  115.1   18
Mai/03  47.418.75
Jun/03  112 15
Jul/03  156.8   17
Ago/03  66.115
Set/03  149.8   14
Out/03  167,1   11.5
Nov/03  269.3   17.5
Dez/03  283.7   
Jan/04  415 1,3
Fev/04  322 8,5
Mar/04  258.7   10.5

-Mensagem original-
De: Greg Snow [mailto:greg.s...@imail.org]
Enviada em: quinta-feira, 9 de dezembro de 2010 17:57
Para: Rodrigo Aluizio; 'R Help'
Assunto: RE: [R] Barplot with "Independent" Lines Y axis

Without seeing a reproducible example we cannot be sure, but my guess is
that you are letting twoord.plot set the limits and the function does not
remove missing values, if you specify rylim and or lylim arguments
specifically, then it should not run into the problem you are seeing (I
hope).

If that does not work, then send a small reproducible example (the dput
command is great for the data part) which will help us find the problem.

-- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain
Healthcare greg.s...@imail.org 801.408.8111

>  -Original Message-
>  From: Rodrigo Aluizio [mailto:r.alui...@gmail.com]
>  Sent: Thursday, December 09, 2010 12:27 PM
>  To: Greg Snow; 'R Help'
>  Subject: RES: [R] Barplot with "Independent" Lines Y axis
>
>  Thank you for the function suggestion, works nicely for complete data
>  vectors. Just another question. When using the twoord.plot I reached
>  another
>  issue, it seems that this function can't handle NAs in one of the
>  variables
>  (the data of one month for another variable is missing). The lines and
>  barplot functions just interrupt the plot and continue after the NA but
>  twoord.plot gives me an error: Error at plot.window(...) : finite
>  values are
>  necessary for 'ylim'
>
>  Is there a way to work around this error?
>
>  P.S.: I'm aware of the problems regarding this type of graph, but this
>  time
>  it's not a choice of mine (unfortunately). Thank you anyway for the
>  highlight, maybe it will help me arguing.
>
>  Regards
>
>  Rodrigo.
>
>  -Mensagem original-
>  De: Greg Snow [mailto:greg.s...@imail.org]
>  Enviada em: quinta-feira, 9 de dezembro de 2010 15:56
>  Para: Rodrigo Aluizio; R Help
>  Assunto: RE: [R] Barplot with "Independent" Lines Y axis
>
>  Look at the twoord.plot function in the plotrix package, but be sure to
>  read
>  the note on the help page, then reread it and take its advice if you
>  decide
>  to stick with this type of plot.
>
>  --
>  Gregory (Greg) L. Snow Ph.D.
>  Statistical Data Center
>  Intermountain Healthcare
>  greg.s...@imail.org
>  801.408.8111
>
>

>  >  -Original Message-
>  >  From:r-help-boun...@r-project.org  [mailto:r-help-boun...@r-
>  >  project.org] On Behalf Of Rodrigo Aluizio
>  >  Sent: Thursday, December 09, 2010 9:44 AM
>  >  To: R Help
>  >  Subject: [R] Barplot with "Independent" Lines Y axis
>  >
>  >  Hi list. I'm plotting pluviometric (Rain) data as a barplot, and then
>  >  adding
>  >  the salinity variable to this plot as lines. Obviously as these Y
>  >  scales are
>  >  completely different the salinity appears at the lower part of the
>  >  graph
>  >  extremely compacted. I need to plot the line at the exactly same area
>  >  of the
>  >  barplot but with its own Y axis (at the right), so the salinity can

>  use

>  >  the
>  >  plot area freely. I tried the par(new=T), but it only works for high
>  >  level
>  >  plot functions (not for lines or points).
>  >
>  >  Below are some example data and the code I'm using:
>  >
>  >  Month   RainSalt
>  >  Fev 365.6   13
>  >  Mar 235 18
>  >  Abr 115.1   18
>  >  Mai 47.418.75
>  >  Jun 112 15
>  >  Jul 156.8   17
>  >  Ago 66.115
>  >  Set 149.8   14
>  >  Out 167.1   11.5
>  >  Nov 269.3   17.5
>  >
>  >  mp<-barplot(Dados$Rain,names.arg=rownames(Dados),ylab='Pluviosidade
>  >  (mm)',width=0.5,ylim=c(0,370),yaxp=c(0,370,10))
>  >  lines(mp,Dados$Salt,type='b',pch=19,lty='dotted')
>  >
>  >  Any ideas?
>  >
>  >  Thank you for the attention.

[R] RES: Barplot with "Independent" Lines Y axis

2010-12-09 Thread Rodrigo Aluizio
Oh sorry. An example say lots more than words. The data below, when
submitted to twoord.plot return the mentioned error. Rain are bars and Salt
lines, the bars appear and the error occurs with the salt data.

Point   RainSalt
Fev/03  365.6   13
Mar/03  235 18
Abr/03  115.1   18
Mai/03  47.418.75
Jun/03  112 15
Jul/03  156.8   17
Ago/03  66.115
Set/03  149.8   14
Out/03  167,1   11.5
Nov/03  269.3   17.5
Dez/03  283.7   
Jan/04  415 1,3
Fev/04  322 8,5
Mar/04  258.7   10.5

-Mensagem original-
De: Greg Snow [mailto:greg.s...@imail.org] 
Enviada em: quinta-feira, 9 de dezembro de 2010 17:57
Para: Rodrigo Aluizio; 'R Help'
Assunto: RE: [R] Barplot with "Independent" Lines Y axis

Without seeing a reproducible example we cannot be sure, but my guess is
that you are letting twoord.plot set the limits and the function does not
remove missing values, if you specify rylim and or lylim arguments
specifically, then it should not run into the problem you are seeing (I
hope).

If that does not work, then send a small reproducible example (the dput
command is great for the data part) which will help us find the problem.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -Original Message-
> From: Rodrigo Aluizio [mailto:r.alui...@gmail.com]
> Sent: Thursday, December 09, 2010 12:27 PM
> To: Greg Snow; 'R Help'
> Subject: RES: [R] Barplot with "Independent" Lines Y axis
> 
> Thank you for the function suggestion, works nicely for complete data
> vectors. Just another question. When using the twoord.plot I reached
> another
> issue, it seems that this function can't handle NAs in one of the
> variables
> (the data of one month for another variable is missing). The lines and
> barplot functions just interrupt the plot and continue after the NA but
> twoord.plot gives me an error: Error at plot.window(...) : finite
> values are
> necessary for 'ylim'
> 
> Is there a way to work around this error?
> 
> P.S.: I'm aware of the problems regarding this type of graph, but this
> time
> it's not a choice of mine (unfortunately). Thank you anyway for the
> highlight, maybe it will help me arguing.
> 
> Regards
> 
> Rodrigo.
> 
> -Mensagem original-
> De: Greg Snow [mailto:greg.s...@imail.org]
> Enviada em: quinta-feira, 9 de dezembro de 2010 15:56
> Para: Rodrigo Aluizio; R Help
> Assunto: RE: [R] Barplot with "Independent" Lines Y axis
> 
> Look at the twoord.plot function in the plotrix package, but be sure to
> read
> the note on the help page, then reread it and take its advice if you
> decide
> to stick with this type of plot.
> 
> --
> Gregory (Greg) L. Snow Ph.D.
> Statistical Data Center
> Intermountain Healthcare
> greg.s...@imail.org
> 801.408.8111
> 
> 
> > -Original Message-
> > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> > project.org] On Behalf Of Rodrigo Aluizio
> > Sent: Thursday, December 09, 2010 9:44 AM
> > To: R Help
> > Subject: [R] Barplot with "Independent" Lines Y axis
> >
> > Hi list. I'm plotting pluviometric (Rain) data as a barplot, and then
> > adding
> > the salinity variable to this plot as lines. Obviously as these Y
> > scales are
> > completely different the salinity appears at the lower part of the
> > graph
> > extremely compacted. I need to plot the line at the exactly same area
> > of the
> > barplot but with its own Y axis (at the right), so the salinity can
> use
> > the
> > plot area freely. I tried the par(new=T), but it only works for high
> > level
> > plot functions (not for lines or points).
> >
> > Below are some example data and the code I'm using:
> >
> > Month   RainSalt
> > Fev 365.6   13
> > Mar 235 18
> > Abr 115.1   18
> > Mai 47.418.75
> > Jun 112 15
> > Jul 156.8   17
> > Ago 66.115
> > Set 149.8   14
> > Out 167.1   11.5
> > Nov 269.3   17.5
> >
> > mp<-barplot(Dados$Rain,names.arg=rownames(Dados),ylab='Pluviosidade
> > (mm)',width=0.5,ylim=c(0,370),yaxp=c(0,370,10))
> > lines(mp,Dados$Salt,type='b',pch=19,lty='dotted')
> >
> > Any ideas?
> >
> > Thank you for the attention.
> >
> > Regards
> >
> > ---
> > MSc. Rodrigo Aluizio
> > Centro de Estudos do Mar/UFPR
> >
> > __
> > 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.

__
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.


[R] RES: Barplot with "Independent" Lines Y axis

2010-12-09 Thread Rodrigo Aluizio
Thank you for the function suggestion, works nicely for complete data
vectors. Just another question. When using the twoord.plot I reached another
issue, it seems that this function can't handle NAs in one of the variables
(the data of one month for another variable is missing). The lines and
barplot functions just interrupt the plot and continue after the NA but
twoord.plot gives me an error: Error at plot.window(...) : finite values are
necessary for 'ylim' 

Is there a way to work around this error?

P.S.: I'm aware of the problems regarding this type of graph, but this time
it's not a choice of mine (unfortunately). Thank you anyway for the
highlight, maybe it will help me arguing.

Regards

Rodrigo.

-Mensagem original-
De: Greg Snow [mailto:greg.s...@imail.org] 
Enviada em: quinta-feira, 9 de dezembro de 2010 15:56
Para: Rodrigo Aluizio; R Help
Assunto: RE: [R] Barplot with "Independent" Lines Y axis

Look at the twoord.plot function in the plotrix package, but be sure to read
the note on the help page, then reread it and take its advice if you decide
to stick with this type of plot.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Rodrigo Aluizio
> Sent: Thursday, December 09, 2010 9:44 AM
> To: R Help
> Subject: [R] Barplot with "Independent" Lines Y axis
> 
> Hi list. I'm plotting pluviometric (Rain) data as a barplot, and then
> adding
> the salinity variable to this plot as lines. Obviously as these Y
> scales are
> completely different the salinity appears at the lower part of the
> graph
> extremely compacted. I need to plot the line at the exactly same area
> of the
> barplot but with its own Y axis (at the right), so the salinity can use
> the
> plot area freely. I tried the par(new=T), but it only works for high
> level
> plot functions (not for lines or points).
> 
> Below are some example data and the code I'm using:
> 
> Month RainSalt
> Fev   365.6   13
> Mar   235 18
> Abr   115.1   18
> Mai   47.418.75
> Jun   112 15
> Jul   156.8   17
> Ago   66.115
> Set   149.8   14
> Out   167.1   11.5
> Nov   269.3   17.5
> 
> mp<-barplot(Dados$Rain,names.arg=rownames(Dados),ylab='Pluviosidade
> (mm)',width=0.5,ylim=c(0,370),yaxp=c(0,370,10))
> lines(mp,Dados$Salt,type='b',pch=19,lty='dotted')
> 
> Any ideas?
> 
> Thank you for the attention.
> 
> Regards
> 
> ---
> MSc. Rodrigo Aluizio
> Centro de Estudos do Mar/UFPR
> 
> __
> 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.

__
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.