BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Josemz94
Calcite | Level 5
I would like to divide one axis of a plot in different scales. I have a data sample distributed mainly between 0 and 10 in the x axis, and a few outliers between 10 and 100. I would like that the interval 0-10 occupies at least half of the x axis and the interval 10-100 the other half, allowing to see clearly the majority of the dots while not losing sight of the few outliers.

Thank you in advanced.
1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

@Josemz94 wrote:
That does not work for me because in my data sample the outliers are distributed more uniformly along the axis. Giving your example, I would need that the 20-230 interval is more compressed than the 0-20 interval. Is it possible?

Thank you.

Perhaps try a logarithmic scale such as

xaxis logbase=10 logstyle=logexpand;

 

View solution in original post

4 REPLIES 4
Reeza
Super User

Create a broken axis like this:

data new;
   input Type $1 Value;
   datalines;
A 10
B 15
C 12
D 17
E 205
F 225
;
run;

proc sgplot data=new;
   vbar type / response=value;
   yaxis ranges=(0-20 200-230);
run;    

 

Code from here:

http://support.sas.com/kb/55/683.html 

 

Note that I've moved your post to the graphics forum as well.


@Josemz94 wrote:
I would like to divide one axis of a plot in different scales. I have a data sample distributed mainly between 0 and 10 in the x axis, and a few outliers between 10 and 100. I would like that the interval 0-10 occupies at least half of the x axis and the interval 10-100 the other half, allowing to see clearly the majority of the dots while not losing sight of the few outliers.

Thank you in advanced.

 

Josemz94
Calcite | Level 5
That does not work for me because in my data sample the outliers are distributed more uniformly along the axis. Giving your example, I would need that the 20-230 interval is more compressed than the 0-20 interval. Is it possible?

Thank you.
Reeza
Super User

@Josemz94 wrote:
That does not work for me because in my data sample the outliers are distributed more uniformly along the axis. Giving your example, I would need that the 20-230 interval is more compressed than the 0-20 interval. Is it possible?

Thank you.

Did you try it and it didn't work? You can specify the intervals as well, so there may be a way, but if you could provide the code you've tried so far that would be helpful.

ballardw
Super User

@Josemz94 wrote:
That does not work for me because in my data sample the outliers are distributed more uniformly along the axis. Giving your example, I would need that the 20-230 interval is more compressed than the 0-20 interval. Is it possible?

Thank you.

Perhaps try a logarithmic scale such as

xaxis logbase=10 logstyle=logexpand;

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1033 views
  • 4 likes
  • 3 in conversation