unordered y axis

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

unordered y axis

ani jaya
Dear R-Help,

I have 35 data that is month when the annual minima happened. So I want to
plot those data but the order of y axis is not from 1 to 12, but let say
start from 9,10,11,12,1,..8. The reason to do this is when 12 (Dec) meet 1
(Jan) in the following year the graph is not quite good (for me).


year<-c(1981:2015)
month<-c(3, 1, 12, 11, 2, 1, 12, 1, 2, 1, 12, 3, 2, 12, 2, 7, 2, 6, 2, 1,
1, 12, 3, 12, 3, 12, 2, 2, 9, 2, 1, 4, 12, 3, 4)
plot(month~year,xaxt="n", type="b", ylab="Month", xlab="Year")
axis(1, at=1986:2015,cex.axis=.8)


Any lead or comment is appreciate.

Best, Ani

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: unordered y axis

Jim Lemon-4
Hi Ani,
There are a number of ways to modify this sort of plot. Here is one:

x11(width=7,height=5)
par(cex.axis=.8)
plot(month~year,xaxt="n", type="l", ylab="Month", xlab="Year",
 main="Month of occurrence in year")
axis(1,at=seq(1981,2014,3))
library(plotrix)
boxed.labels(year,month,month.abb[month],border=NA,cex=0.7)

Jim

On Thu, Nov 7, 2019 at 1:24 PM ani jaya <[hidden email]> wrote:

>
> Dear R-Help,
>
> I have 35 data that is month when the annual minima happened. So I want to
> plot those data but the order of y axis is not from 1 to 12, but let say
> start from 9,10,11,12,1,..8. The reason to do this is when 12 (Dec) meet 1
> (Jan) in the following year the graph is not quite good (for me).
>
>
> year<-c(1981:2015)
> month<-c(3, 1, 12, 11, 2, 1, 12, 1, 2, 1, 12, 3, 2, 12, 2, 7, 2, 6, 2, 1,
> 1, 12, 3, 12, 3, 12, 2, 2, 9, 2, 1, 4, 12, 3, 4)
> plot(month~year,xaxt="n", type="b", ylab="Month", xlab="Year")
> axis(1, at=1986:2015,cex.axis=.8)
>
>
> Any lead or comment is appreciate.
>
> Best, Ani
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: unordered y axis

ani jaya
Dear Jim,

Thank you very much for nice suggestion and figure there. But what I need
is the y axis start from let say 7 (July) and end at 6 (June).
In those sense, I can said clearly that the occurrence, minima in this
case, is fall during winter season, because Jan and Dec close to each other.
Actually everything is good, but I want to 'kill' my curiosity.

year<-c(1981:2015)
month<-c(3, 1, 12, 11, 2, 1, 12, 1, 2, 1, 12, 3, 2, 12, 2, 7, 2, 6, 2, 1,
1, 12, 3, 12, 3, 12, 2, 2, 9, 2, 1, 4, 12, 3, 4)
plot(month~year,xaxt="n", type="b", ylab="Month", xlab="Year")
axis(1, at=1981:2015,cex.axis=.8)

Best,
Ani


On Thu, Nov 7, 2019 at 12:15 PM Jim Lemon <[hidden email]> wrote:

> Hi Ani,
> There are a number of ways to modify this sort of plot. Here is one:
>
> x11(width=7,height=5)
> par(cex.axis=.8)
> plot(month~year,xaxt="n", type="l", ylab="Month", xlab="Year",
>  main="Month of occurrence in year")
> axis(1,at=seq(1981,2014,3))
> library(plotrix)
> boxed.labels(year,month,month.abb[month],border=NA,cex=0.7)
>
> Jim
>
> On Thu, Nov 7, 2019 at 1:24 PM ani jaya <[hidden email]> wrote:
> >
> > Dear R-Help,
> >
> > I have 35 data that is month when the annual minima happened. So I want
> to
> > plot those data but the order of y axis is not from 1 to 12, but let say
> > start from 9,10,11,12,1,..8. The reason to do this is when 12 (Dec) meet
> 1
> > (Jan) in the following year the graph is not quite good (for me).
> >
> >
> > year<-c(1981:2015)
> > month<-c(3, 1, 12, 11, 2, 1, 12, 1, 2, 1, 12, 3, 2, 12, 2, 7, 2, 6, 2, 1,
> > 1, 12, 3, 12, 3, 12, 2, 2, 9, 2, 1, 4, 12, 3, 4)
> > plot(month~year,xaxt="n", type="b", ylab="Month", xlab="Year")
> > axis(1, at=1986:2015,cex.axis=.8)
> >
> >
> > Any lead or comment is appreciate.
> >
> > Best, Ani
> >
> >         [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > 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.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: unordered y axis

Jim Lemon-4
That's not too hard:

x11(width=7,height=5)
par(cex.axis=.8)
fin_month<-month
fin_month[fin_month>6]<-fin_month[fin_month>6]-12
fin_month<-fin_month+6
plot(fin_month~year,axes=FALSE,type="l", ylab="Month", xlab="Year",
 main="Month of occurrence in year")
axis(1,at=seq(1981,2014,3))
fin_months<-month.abb[c(7:12,1:6)]
axis(2,at=1:12,labels=month.abb[c(7:12,1:6)])
library(plotrix)
boxed.labels(year,fin_month,month.abb[month],border=NA,cex=0.7)

Jim

On Thu, Nov 7, 2019 at 3:35 PM ani jaya <[hidden email]> wrote:

>
> Dear Jim,
>
> Thank you very much for nice suggestion and figure there. But what I need is the y axis start from let say 7 (July) and end at 6 (June).
> In those sense, I can said clearly that the occurrence, minima in this case, is fall during winter season, because Jan and Dec close to each other.
> Actually everything is good, but I want to 'kill' my curiosity.
>
> year<-c(1981:2015)
> month<-c(3, 1, 12, 11, 2, 1, 12, 1, 2, 1, 12, 3, 2, 12, 2, 7, 2, 6, 2, 1, 1, 12, 3, 12, 3, 12, 2, 2, 9, 2, 1, 4, 12, 3, 4)
> plot(month~year,xaxt="n", type="b", ylab="Month", xlab="Year")
> axis(1, at=1981:2015,cex.axis=.8)
>
> Best,
> Ani
>
>
> On Thu, Nov 7, 2019 at 12:15 PM Jim Lemon <[hidden email]> wrote:
>>
>> Hi Ani,
>> There are a number of ways to modify this sort of plot. Here is one:
>>
>> x11(width=7,height=5)
>> par(cex.axis=.8)
>> plot(month~year,xaxt="n", type="l", ylab="Month", xlab="Year",
>>  main="Month of occurrence in year")
>> axis(1,at=seq(1981,2014,3))
>> library(plotrix)
>> boxed.labels(year,month,month.abb[month],border=NA,cex=0.7)
>>
>> Jim
>>
>> On Thu, Nov 7, 2019 at 1:24 PM ani jaya <[hidden email]> wrote:
>> >
>> > Dear R-Help,
>> >
>> > I have 35 data that is month when the annual minima happened. So I want to
>> > plot those data but the order of y axis is not from 1 to 12, but let say
>> > start from 9,10,11,12,1,..8. The reason to do this is when 12 (Dec) meet 1
>> > (Jan) in the following year the graph is not quite good (for me).
>> >
>> >
>> > year<-c(1981:2015)
>> > month<-c(3, 1, 12, 11, 2, 1, 12, 1, 2, 1, 12, 3, 2, 12, 2, 7, 2, 6, 2, 1,
>> > 1, 12, 3, 12, 3, 12, 2, 2, 9, 2, 1, 4, 12, 3, 4)
>> > plot(month~year,xaxt="n", type="b", ylab="Month", xlab="Year")
>> > axis(1, at=1986:2015,cex.axis=.8)
>> >
>> >
>> > Any lead or comment is appreciate.
>> >
>> > Best, Ani
>> >
>> >         [[alternative HTML version deleted]]
>> >
>> > ______________________________________________
>> > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>> > 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.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: unordered y axis

ani jaya
Thank you very much, Jim. You help a lot!

On Thu, Nov 7, 2019 at 2:09 PM Jim Lemon <[hidden email]> wrote:

> That's not too hard:
>
> x11(width=7,height=5)
> par(cex.axis=.8)
> fin_month<-month
> fin_month[fin_month>6]<-fin_month[fin_month>6]-12
> fin_month<-fin_month+6
> plot(fin_month~year,axes=FALSE,type="l", ylab="Month", xlab="Year",
>  main="Month of occurrence in year")
> axis(1,at=seq(1981,2014,3))
> fin_months<-month.abb[c(7:12,1:6)]
> axis(2,at=1:12,labels=month.abb[c(7:12,1:6)])
> library(plotrix)
> boxed.labels(year,fin_month,month.abb[month],border=NA,cex=0.7)
>
> Jim
>
> On Thu, Nov 7, 2019 at 3:35 PM ani jaya <[hidden email]> wrote:
> >
> > Dear Jim,
> >
> > Thank you very much for nice suggestion and figure there. But what I
> need is the y axis start from let say 7 (July) and end at 6 (June).
> > In those sense, I can said clearly that the occurrence, minima in this
> case, is fall during winter season, because Jan and Dec close to each other.
> > Actually everything is good, but I want to 'kill' my curiosity.
> >
> > year<-c(1981:2015)
> > month<-c(3, 1, 12, 11, 2, 1, 12, 1, 2, 1, 12, 3, 2, 12, 2, 7, 2, 6, 2,
> 1, 1, 12, 3, 12, 3, 12, 2, 2, 9, 2, 1, 4, 12, 3, 4)
> > plot(month~year,xaxt="n", type="b", ylab="Month", xlab="Year")
> > axis(1, at=1981:2015,cex.axis=.8)
> >
> > Best,
> > Ani
> >
> >
> > On Thu, Nov 7, 2019 at 12:15 PM Jim Lemon <[hidden email]> wrote:
> >>
> >> Hi Ani,
> >> There are a number of ways to modify this sort of plot. Here is one:
> >>
> >> x11(width=7,height=5)
> >> par(cex.axis=.8)
> >> plot(month~year,xaxt="n", type="l", ylab="Month", xlab="Year",
> >>  main="Month of occurrence in year")
> >> axis(1,at=seq(1981,2014,3))
> >> library(plotrix)
> >> boxed.labels(year,month,month.abb[month],border=NA,cex=0.7)
> >>
> >> Jim
> >>
> >> On Thu, Nov 7, 2019 at 1:24 PM ani jaya <[hidden email]> wrote:
> >> >
> >> > Dear R-Help,
> >> >
> >> > I have 35 data that is month when the annual minima happened. So I
> want to
> >> > plot those data but the order of y axis is not from 1 to 12, but let
> say
> >> > start from 9,10,11,12,1,..8. The reason to do this is when 12 (Dec)
> meet 1
> >> > (Jan) in the following year the graph is not quite good (for me).
> >> >
> >> >
> >> > year<-c(1981:2015)
> >> > month<-c(3, 1, 12, 11, 2, 1, 12, 1, 2, 1, 12, 3, 2, 12, 2, 7, 2, 6,
> 2, 1,
> >> > 1, 12, 3, 12, 3, 12, 2, 2, 9, 2, 1, 4, 12, 3, 4)
> >> > plot(month~year,xaxt="n", type="b", ylab="Month", xlab="Year")
> >> > axis(1, at=1986:2015,cex.axis=.8)
> >> >
> >> >
> >> > Any lead or comment is appreciate.
> >> >
> >> > Best, Ani
> >> >
> >> >         [[alternative HTML version deleted]]
> >> >
> >> > ______________________________________________
> >> > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> >> > 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.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.