one common legend in SPGRAPH

For questions and discussion related to graphs, reports, and other output, including issues related to presenting or publishing results.
sleu123
Posts: 11
Joined: Sat Apr 11, 2009 3:53 am

one common legend in SPGRAPH

Unread post by sleu123 »

Dear Tom,

I am plotting FEVD stacked graphs for 3 different countries. Each country is decomposed by five factors. I am wondering whether it is possible to have one common legend showing the colour scheme of the five factors at the bottom of the SPGRAPH? If not with SPGRAPH, what might be another way of doing so in RATS?

Code: Select all

spgraph(vfields=2,hfields=2)
graph(header='Australia',number=0,style=stacked,min=0,max=100,scale=both) 5
# AUS_FEVD_RG; # AUS_FEVD_US; # AUS_FEVD_EU; # AUS_FEVD_JP; # AUS_FEVD_CN
graph(header='Hong Kong',number=0,style=stacked,min=0,max=100,scale=both) 5
# HK_FEVD_RG; # HK_FEVD_US; # HK_FEVD_EU; # HK_FEVD_JP; # HK_FEVD_CN
graph(header='New Zealand',number=0,style=stacked,min=0,max=100,scale=both) 5
# NZ_FEVD_RG; # NZ_FEVD_US; # NZ_FEVD_EU; # NZ_FEVD_JP; # NZ_FEVD_CN
spgraph(done)
Thanks for your time in advance.

Regards,

Shawn
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: one common legend in SPGRAPH

Unread post by TomDoan »

The common legend has been added with version 9. To the outer SPGRAPH, you would add the options

STYLE=STACKED,KEY=BELOW,KLABELS=||"RG","US","EU","JP","CN"|| (or whatever you want for the labels).
Anne
Posts: 2
Joined: Thu Nov 08, 2018 2:10 pm

Re: one common legend in SPGRAPH

Unread post by Anne »

Hi Tom

Is it possible to use a common legend with spgraph that can control the colors associated with series. When I try to implement this I can only seem to get the first 2 colors black and blue if I am plotting 2 series rather than the colors I have selected using the graph option i.e. the key colors don’t correspond to the actual colors plotted in the graphs
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: one common legend in SPGRAPH

Unread post by TomDoan »

Use the SYMBOLS option to remap the symbol styles.
Anne
Posts: 2
Joined: Thu Nov 08, 2018 2:10 pm

Re: one common legend in SPGRAPH

Unread post by Anne »

Thanks Tom
Worked Perfectly
Post Reply