[R] Plotrix pyramid plot: request for a little help

Jim Lemon drj|m|emon @end|ng |rom gm@||@com
Wed Jun 7 06:27:23 CEST 2023


Hi Mohsin,
As I don't have your data, I had to fake it, so there are probably
some mistakes in the example below:

# my suggestion
x<-c(143,108,95,72,70,85,125,123,64,67,144,55,60,200,70,100,65,140,49,45,77,58,66,50,77)
y<-c(41,32,28,13,15,29,72,71,17,180,9,13,145,29,56,22,97,13,9,42,20,7,30,10,41)
labels<-c("sector","increase","period","foreign","compared","exchange","rate",
 "expected","impact","mpc","oil","sbp","growth","credit","economic","private",
 "year","government","improvement","months","average","cpi","real","net",
 "developments")
top25_df<-data.frame(x=x,y=y,labels=labels)
pyramid.plot(top25_df$x,top25_df$y,
 labels=top25_df$labels,
 main="Words Common in MPS statements",
 gap=40,
 unit="Count",
 top.labels=c("2016-20","Words","2021-23"),
 laxlab=seq(0,200,by=25),raxlab=seq(0,200,by=25))

To answer your question, I used the "laxlab" and "raxlab" arguments. I
also extended them to 0-200 to cover the range of the largest counts.
You can use 0-150 for both, but it is not a good idea to req I added
the unit="Count", which you can delete if you don't want it. I think
it's a good idea to let the viewer know what the units are. Apart from

On Tue, Jun 6, 2023 at 3:39 PM Mohsin Waheed <mohsin.waheed using hotmail.com> wrote:
>
> Hi,
>
>
>
> I am working on a research study wherein I have employed a variety of textual analysis methods including plotrix pyramid plot. However, with the pyramid plot, I am unable to set the x-axis limits; for example, how can I manually define the frequency range as 0, 50, 100, 150…
>
>
>
> Would really appreciate your reply. Plot and codes files are attached for your perusal.
>
>
>
> Regards,
>
>
>
> Mohsin
>
>
>
>
>
> Sent from Mail for Windows
>
>



More information about the R-help mailing list