# [R] Plot qualitative y axis

Jim Lemon drj|m|emon @end|ng |rom gm@||@com
Thu May 24 01:34:59 CEST 2018

```Hi Pedro,
Not too hard. Just have to watch the order of the variables:

I 10 106
II 124 484
III 321 874
IV 777 1140
V 896 996
VI 1706 1250
VII 635 433
VIII 1437 654
IX 693 333
X 1343 624
XI 1221 611
XII 25 15
XIII 3 NA
XIV 7 8",
plot(rev(ppdf[,2]),1:14,col="blue",lty=1,type="l",
yaxt="n",ylab="N",xlab="ppdf[,2]")
points(rev(ppdf[,3]),1:14,col="red",lty=1,type="l")
axis(2,at=1:14,labels=rev(ppdf[,1]))
legend(1300,14,c("M","W"),fill=c("blue","red"))

Jim

On Wed, May 23, 2018 at 7:44 AM, Pedro páramo <percentil101 using gmail.com> wrote:
>
>
> 2018-05-22 23:44 GMT+02:00 Pedro páramo <percentil101 using gmail.com>:
>>
>> Many thanks,
>>
>> My goal is to make a plott like attached but the Y axis starts in XIV and
>> end at top in I.  Generally for instance in excel X axis is categories but Y
>> axis is numbers I want the contrary plotted in lines, your last help is near
>> what I look but barplot is not needed.
>>
>> Hope you can help me thanks in advance.
>>
>> 2018-05-22 0:58 GMT+02:00 Jim Lemon <drjimlemon using gmail.com>:
>>>
>>> Hi Pedro,
>>> In addition to the other suggestions, here's a guess at what you want
>>> by the lines for M and W:
>>>
>>> I 10 106
>>> II 124 484
>>> III 321 874
>>> IV 777 1140
>>> V 896 996
>>> VI 1706 1250
>>> VII 635 433
>>> VIII 1437 654
>>> IX 693 333
>>> X 1343 624
>>> XI 1221 611
>>> XII 25 15
>>> XIII 3 NA
>>> XIV 7 8",
>>> barpos<-barplot(t(as.matrix(ppdf[,2:3])),horiz=TRUE,
>>>  names.arg=ppdf\$N,beside=TRUE,col=c("red","blue"))
>>> legend(1000,8,c("W","M"),fill=c("blue","red"))
>>> lines(ppdf\$W,barpos[2,],col="blue")
>>> lines(ppdf\$M,barpos[1,],col="red")
>>>
>>> Jim
>>>
>>>
>>> On Mon, May 21, 2018 at 10:44 PM, Pedro páramo <percentil101 using gmail.com>
>>> wrote:
>>> > Hi all,
>>> >
>>> > I´m trying to plot this data
>>> >
>>> > N M W
>>> > I 10 106
>>> > II 124 484
>>> > III 321 874
>>> > IV 777 1140
>>> > V 896 996
>>> > VI 1706 1250
>>> > VII 635 433
>>> > VIII 1437 654
>>> > IX 693 333
>>> > X 1343 624
>>> > XI 1221 611
>>> > XII 25 15
>>> > XIII 3
>>> > XIV 7 8
>>> > So that in de Y axis will be the level (qualitative data) and in the X
>>> > axis
>>> > will be M and W variables. So x axis will be wwith a lenght between 0
>>> > and
>>> > 2000.
>>> >
>>> > I would like to plot a line with M and other with W so it will be
>>> > obvious
>>> > that above V (in the Y axis) thera are more W and below level V there
>>> > are
>>> > more M.
>>> >
>>> > Can you please guide me?
>>> >
>>> > In excel putting Y as X axis is easy but dind´nt achieve to invert rows
>>> > and
>>> > I ´m trying to plot it in R.
>>> >
>>> > Many thanks in advance
>>> >
>>> >         [[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