Data visualization with SAS programming

how to add superscript in title statement before GPLOT procedure

Reply
Occasional Contributor
Posts: 13

how to add superscript in title statement before GPLOT procedure

Hi,

I want to produce superscript in the Y-axis label and in plot title. Can anyone please suggest the trick? The code before GPLOT is given below. Second issue I have with this code is that it is not generating different line styles but producing different colors. Third issue is that it is not increasing the thickness and smoothness of curves as per the code.

goptions reset=goptions nodisplay device=png300

         ftext='Times New Roman/bold' ftitle='Times New Roman/bold'

Symbol1 INTERPOL=LP5 w=2.5 Line=1;

Symbol2 INTERPOL=LP5 w=2.5 Line=2;

Symbol3 INTERPOL=LP5 w=2.5 Line=3;

Symbol4 INTERPOL=LP5 w=2.5 Line=35;

legend1 label=none  /*position=(left top inside) */;

axis1 order  = (30 to 110 by 10) offset = (2pct,2pct)

      value  = (angle=0 rotate=0)

      label  = (angle=0 'Days after planting')

      minor  = none

      origin = (15pct,20pct)

      length = 25pct; 

axis2 order  = (0 to 20 by 4) offset = (1,0)

      label  = (angle=90 'Total dry matter accumulation (Mg/ha)')

      minor  = none

      length = 60pct;

title1 move=(25pct,85pct) h=11pt "Nitrogen rate = 67 kg ha-1";

axis1  order = (30 to 110 by 10) offset = (2pct,2pct)

       label = (angle=0 'Days after planting')

       value  = (angle=0 rotate=0)

       minor = none

       origin = (40pct,20pct)

       length = 25pct;  

axis2  order  = (0 to 20 by 4) offset = (1,0)

       label  = none value=none

       minor  = none major=none

       length = 60pct;

title1 move=(50pct,85pct) h=11pt "Nitrogen rate = 134 kg ha-1";

Proc GPlot data= test;

   format estimate 8.0;

   where Nrate=134;

   Plot  estimate*sampling = cultivar/    haxis=axis1 vaxis=axis2 /*VMINOR=10*/

                             legend=legend1 GRID noframe name='Nrate2';

run; quit;

Thanks,

Bhupinder

Grand Advisor
Posts: 10,223

Re: how to add superscript in title statement before GPLOT procedure

The last AXIS statement ecountered is used to build the axis, so the second AXIS2 with label=none is preventing your y axis. What part of the title do you want superscripted?

What part of the y axis label do you want superscripted?

Your symbol statements are going to use the default colors as in your current active style. If you want the same color specify in SYMBOL statemens c=black for instance (probably best), or a Goptions color list. Your symbol statements also all have the same width, 2.5, and interpolation options. LP5. So they will be the same width and the same smoothness.

Occasional Contributor
Posts: 13

Re: how to add superscript in title statement before GPLOT procedure

I want to keep superscript of (-1) in title1 move=(50pct,85pct) h=11pt "Nitrogen rate = 134 kg ha-1"; and in title1 move=(50pct,85pct) h=11pt "Nitrogen rate = 134 kg ha-1";

The full updated code runs as given below. I am able to change the color and line styles but I couldn't make look curves more smoother and thick. Changing W values didn't change the thickness.

goptions reset=goptions nodisplay device=png300

         ftext='Times New Roman/bold' ftitle='Times New Roman/bold'

            ;

Symbol1 INTERPOL=LP5 w=3.5 c=black L=1;

Symbol2 INTERPOL=LP5 w=3.5 c=black L=2;

Symbol3 INTERPOL=LP5 w=3.5 c=gray L=1;

Symbol4 INTERPOL=LP5 w=3.5 c=gray L=2;

legend1 label=none  position=(left top inside) across=1;

axis1 order  = (30 to 110 by 10) offset = (2pct,2pct)

      value  = (angle=0 rotate=0)

      label  = (angle=0 'Days after planting')

      minor  = none

      origin = (15pct,20pct)

      length = 25pct; 

axis2 order  = (0 to 20 by 4) offset = (1,0)

      label  = (angle=90 'Total dry matter accumulation (Mg/ha)')

      minor  = none

      length = 60pct;

title1 move=(25pct,85pct) h=11pt "Nitrogen rate = 67 kg ha-1";

Proc GPlot data= test;

   format estimate 8.0;

   where Nrate=67;

   Plot estimate*sampling = cultivar/    haxis=axis1 vaxis=axis2 /*VMINOR=10*/

                                        legend=legend1 GRID noframe name='Nrate1';

run; quit;

axis1  order = (30 to 110 by 10) offset = (2pct,2pct)

       label = (angle=0 'Days after planting')

       value  = (angle=0 rotate=0)

       minor = none

       origin = (40pct,20pct)

       length = 25pct;  

axis2  order  = (0 to 20 by 4) offset = (1,0)

       label  = none value=none

       minor  = none major=none

       length = 60pct;

title1 move=(50pct,85pct) h=11pt "Nitrogen rate = 134 kg ha-1";

Proc GPlot data= test;

   format estimate 8.0;

   where Nrate=134;

   Plot  estimate*sampling = cultivar/    haxis=axis1 vaxis=axis2 /*VMINOR=10*/

                              nolegend GRID noframe name='Nrate2';

run; quit;

axis1 order = (30 to 110 by 10) offset = (2pct,2pct)

      label = (angle=0 'Days after planting')

       value  = (angle=0 rotate=0)

      minor=none

      origin = (65pct,20pct)

      length = 25pct;  

     

axis2 order  = (0 to 20 by 4) offset = (1,0)

      label  = none value=none

      minor  = none major=none

      length = 60pct;

title1 move=(75pct,85pct) h=11pt "Nitrogen rate = 201 kg ha-1";

Proc GPlot data= test;

   format estimate 8.0;

   where Nrate=201;

   Plot  estimate*sampling = cultivar/haxis=axis1 vaxis=axis2  /*VMINOR=10*/

                                      nolegend GRID noframe name='Nrate3';

run; quit;

title1 "2010"; 

proc gslide name='gslide';

run;

quit;

goptions display gsfname=grafout xmax=9in ymax=5in;  

filename grafout 'C:\Users\bfarmaha\Desktop\TDM.jpeg'; 

title1 "2010";

proc greplay nofs tc=sashelp.templt template=whole;

   igout gseg;

   treplay 1:Nrate1 1:Nrate2 1:Nrate3 1:gslide;

run;

quit;

SAS Employee
Posts: 967

Re: how to add superscript in title statement before GPLOT procedure

Are you 100% certain you're greplaying the latest graphs?

(You could try changing some of the title text, or color, etc just to make sure.)

As a temporary test, maybe try changing the line interpolation to something simple like 'i=join' and double or triple the width.

Ask a Question
Discussion stats
  • 3 replies
  • 277 views
  • 0 likes
  • 3 in conversation