BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Bill3
Calcite | Level 5

Are there any parameter similar to the Makercharacterposition about scatterplot setp.

I want to adjust the trianglerightfilled position.

scatterplot x= y= / markerattrs=(symbol=trianglerightfilled)

1 ACCEPTED SOLUTION

Accepted Solutions
MarciaS
SAS Employee

You can use the DISCRETEOFFSET= option on the SCATTERPLOT statement to make small adjustments to the position of the marker symbol IF your axis is a discrete type axis. 

 

If your axis is not a discrete type axis, one method to add symbols on your graph with adjusted position is to place the symbol using the MARKERCHARACTER= option on the SCATTERPLOT statement.

 

To to this, you would create a variable in your data set to use in the MARKERCHARACTER= option and specify the MARKERCHARACTERPOSITION= option to adjust the position of the symbol. 

 

To see the desired symbol, you would define a format with PROC FORMAT that uses the unicode function with the 4 digit hex value for the unicode symbol you want to see and associate the format with the MARKERCHARACTER= variable.

Note that the format value must be expressed  using the default ODS escape sequence (*ESC*) preceeding the unicode function with hex value for the unicode symbol. Additionally, the MARKERCHARACTERATTRS= option might be necessary to reference a format that supports the unicode character you want to place on the graph. 

 

The following sample demonstrates how to do this. 

 

data sample;    
  label="trianglerightfilled";
  do x=1 to 5;
	  output;
  end;
run;
proc format;
  value $ myfmt
	  'trianglerightfilled'="(*ESC*){unicode '25b6'x}";
run;
ods path(prepend) work.templat(update);
proc template;
  define statgraph plot;
	  begingraph;
		  layout overlay;
			  scatterplot x=x y=x / markercharacter=label labelstrip=true 
				  markercharacterattrs=(family='Arial Unicode MS' size=14pt)
          markercharacterposition=topright;
 			endlayout;
		endgraph;
	end;
run;
proc sgrender data=sample template=plot;
  format label $myfmt.;
run;

Hope this helps.

 

View solution in original post

6 REPLIES 6
ballardw
Super User

Are you asking "is there another option other than Markercharacterposition"?

 

What sort of adjustment do you want?

Jitter=Auto will apply small differences to position controlled with options in the JITTEROPTS=(jitter-options) settings. Not going to list all the possibilities, read the online help for SCATTERPLOT.

 

With any question it is a good idea to include the entire code you have not just one line. That way we can avoid suggesting an option that may not be compatible with other options you are using or may allow other alternatives.

There are so many possible interactions/limitations with the graphic options this goes double for them.

MarciaS
SAS Employee

You can use the DISCRETEOFFSET= option on the SCATTERPLOT statement to make small adjustments to the position of the marker symbol IF your axis is a discrete type axis. 

 

If your axis is not a discrete type axis, one method to add symbols on your graph with adjusted position is to place the symbol using the MARKERCHARACTER= option on the SCATTERPLOT statement.

 

To to this, you would create a variable in your data set to use in the MARKERCHARACTER= option and specify the MARKERCHARACTERPOSITION= option to adjust the position of the symbol. 

 

To see the desired symbol, you would define a format with PROC FORMAT that uses the unicode function with the 4 digit hex value for the unicode symbol you want to see and associate the format with the MARKERCHARACTER= variable.

Note that the format value must be expressed  using the default ODS escape sequence (*ESC*) preceeding the unicode function with hex value for the unicode symbol. Additionally, the MARKERCHARACTERATTRS= option might be necessary to reference a format that supports the unicode character you want to place on the graph. 

 

The following sample demonstrates how to do this. 

 

data sample;    
  label="trianglerightfilled";
  do x=1 to 5;
	  output;
  end;
run;
proc format;
  value $ myfmt
	  'trianglerightfilled'="(*ESC*){unicode '25b6'x}";
run;
ods path(prepend) work.templat(update);
proc template;
  define statgraph plot;
	  begingraph;
		  layout overlay;
			  scatterplot x=x y=x / markercharacter=label labelstrip=true 
				  markercharacterattrs=(family='Arial Unicode MS' size=14pt)
          markercharacterposition=topright;
 			endlayout;
		endgraph;
	end;
run;
proc sgrender data=sample template=plot;
  format label $myfmt.;
run;

Hope this helps.

 

DanH_sas
SAS Super FREQ

Sorry @MarciaS , I missed that you referred to this same trick in your post.

Bill3
Calcite | Level 5
labelstrip=true ,markercharacterattrs=(family='Arial Unicode MS' size=14pt)
It's right in my code, thank you very much!
DanH_sas
SAS Super FREQ

You can do it by defining a new symbol, referring to a "right triangle" glyph in a full-featured Unicode font (such as "Arial Unicode MS"). You can use the HOFFSET / VOFFSET options to move it from center. In the example below, I added a "centered", circle-filled scatter plot as a reference.

 

proc sgplot data=sashelp.class noautolegend;
symbolchar name=rt char='25B6'x /
            textattrs=(family="Arial Unicode MS") hoffset=0.2;
scatter x=weight y=height / markerattrs=(symbol=circlefilled);
scatter x=weight y=height / markerattrs=(symbol=rt size=30);
run;
Bill3
Calcite | Level 5
Thank you for your "Arial Unicode MS".

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 6 replies
  • 500 views
  • 8 likes
  • 4 in conversation