cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
JustinSuIntel
Level II

How can I change all X axes in a graph builder to log scale

Double-clicking through the axes is a real headache.

 

JustinSuIntel_0-1680678886600.png

 

6 REPLIES 6
txnelson
Super User

Re: How can I change all X axes in a graph builder to log scale

One way to handle this, is to use Standardize Attributes to change the Axis Column Property.

To change all of the axes to log:

  1. Go to the data table, and select the columns you want change the axes for
  2. Select          Cols=>Standardize Attributes
  3.  Select         Column Properties=>Axis
  4. Click on        Set Default Axis Settings
  5. Change the Scale from Linear to Log
  6. Click OK

The axes for all of the X axes in the graph will be changed to a log scale

Jim
JustinSuIntel
Level II

Re: How can I change all X axes in a graph builder to log scale

Thanks a lot for the suggestion.

 

However, my use of Graph Builder is quite dynamic and often hard to predict what columns will be used for plotting.

 

Is there a script that I can use to convert the X axes already used by a Graph Builder figure?

 

For example, I know I can do that for scatterplot matrix with 

 

	For( i = 100, i < 200, i++,
		(Current Window() << XPath( "//ScaleBox[@charID=" || Char( i ) || "]" )) << Revert Axis
		 << {Scale( "Log" ), Inc( 1 ), Minor Ticks( 1 )}
	)

 

Re: How can I change all X axes in a graph builder to log scale

You do not need to iterate. The list of display boxes will distribute the messages it receives to each of its items automatically, so you only need to make sure that the list is correct. For example:

 

Names Default to Here( 1 );

dt = Open( "$SAMPLE_DATA/Fitness.jmp" );

sm = dt << Scatterplot Matrix(
	Y( :Age, :Weight, :Oxy, :Runtime, :RunPulse, :RstPulse, :MaxPulse ),
	Matrix Format( "Lower Triangular" )
);
(Report( sm ) << XPath( "//AxisBox" ))
	<< Revert Axis
	<< Scale( "Log" )
	<< Inc( 10 )
	<< Minor Ticks( 0 );
JustinSuIntel
Level II

Re: How can I change all X axes in a graph builder to log scale

My problem is that I want to keep y axes in linear scale but change x axes into log scale. Without iteration, I am afraid that both X/Y axes will be switched to log scale.

 

By the way, does similar approach work for Graph Builder?

 

Re: How can I change all X axes in a graph builder to log scale

This approach still works. Subscript the list first to get a new list with only the axis boxes you want to change, then send the messages to that target list. This way is still much easier and cleaner than explicit looping.

 

Here is a modification to my first example to illustrate the new approach:

 

Names Default to Here( 1 );

dt = Open( "$SAMPLE_DATA/Fitness.jmp" );

sm = dt << Scatterplot Matrix(
	Y( :Age, :Weight, :Oxy, :Runtime, :RunPulse, :RstPulse, :MaxPulse ),
	Matrix Format( "Lower Triangular" )
);

// change X axes only in Scatterplot Matrix
axes = Report( sm ) << XPath( "//AxisBox" );
nAxes = N Items( axes );

// second half of list only
axes[((nAxes/2)+1)::nAxes] << Select; // Scale( "Log" );

It doesn't work well with the Scatterplot Matrix, though, because all but one data column is used in the X and Y role, and internal logic tries to keep changes consistent in both places (X and Y role).

JustinSuIntel
Level II

Re: How can I change all X axes in a graph builder to log scale

Since I can't find a way to identify X axes from Y axes, my current solution is using this command to set all axes to log scale and then manually reverting Y axes to linear scale, which is much easier than manual setting of log scale.

 

( Current Window() << XPath( "//AxisBox" ) ) << Revert Axis << {Scale( "Log" ), Inc( 1 ), Minor Ticks( 1 )}