[R] unordered y axis

Jim Lemon drj|m|emon @end|ng |rom gm@||@com
Thu Nov 7 06:08:53 CET 2019


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 <gaaauul using gmail.com> 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 <drjimlemon using gmail.com> 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 <gaaauul using gmail.com> 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]]
>> >
>> > ______________________________________________
>> > R-help using r-project.org 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.



More information about the R-help mailing list