BookmarkSubscribeRSS Feed
ampatella
New User | Level 1

Hello,

Is it possible to create a break in the x-axis with the range following the break at a different distribution/scale than the data prior to the break? For example, prior to the break the x-axis ranges from 0 to 11 by 1, taking up the majority of the graph space. After the break at 11, the range is from 11-16 by 1, but more condensed, only occupying the last 10% or so of the graph. (Most data to display occurs prior to x=11.) I've attached a screenshot of the desired x-axis with the break and proper distributions prior to and after the break.

 

Screenshot 2025-11-24 074129.png

 

Thanks so much in advance!

1 REPLY 1
BrunoMueller
SAS Super FREQ

As a start have a look here https://blogs.sas.com/content/graphicallyspeaking/2012/05/31/broken-y-axis/ it provides a code sample that does the break of an axis "manually". You will have to use the GTL (Graph Template Language). I have taken the above example and adapted it for a broken X axis. Since you did not provide any data and what kind of plot you want I assumed something.

 

See this sample:

data plotdata;
  do month = 1 to 14;
    value = rand("integer", 10, 20);
    output;
  end;
run;

/*-- manual break in axis --*/
proc template;
  define statgraph series_break;
    begingraph;
      /* the columweights determine the space available */
      layout lattice / columns=2 rowdatarange=union columnweights=(0.9 0.1) ;
        layout overlay / 
          xaxisopts=(
            griddisplay=on display=(ticks tickvalues label) 
            tickvalueattrs=(size=7)
             linearopts=(viewmin=1 viewmax=11 TICKVALUELIST=(1 2 3 4 5 6 7 8 9 10))
             offsetmax=0
          );
          seriesplot x=month y=value;
        endlayout;
        layout overlay / 
          xaxisopts=(
            griddisplay=on display=(ticks tickvalues) 
            tickvalueattrs=(size=7)
            linearopts=(viewmin=11 TICKVALUELIST=(11 12 13 14))
            offsetmin=0
          )
          yaxisopts=( display=none)
        ;
          seriesplot x=month y=value;
        endlayout;
      endlayout;
    endgraph;
  end;
run;

ods graphics / reset=all;

proc sgrender data=plotdata template=series_break;
run;d 

 

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 93 views
  • 3 likes
  • 2 in conversation