cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.

How to have custom X-Y grid spacing in a plot?

Neo
Neo
Level VI

In the plot generated by the example script below, how do I have a custom grid say spaced 25 apart on both X & Y axis (and color the grid lines with a chosen color and increase line width of the grid lines)?

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Little Pond.jmp" );
dt << Contour Plot(
	X( :X, :Y ),
	Y( :Z ),
	Show Data Points( 0 ),
	Fill Areas( 0 ),
	Label Contours( 0 ),
	Transform( "Range Normalized" ),
	Specify Contours( Min( -4 ), Max( 8 ), N( 7 ) ),
	SendToReport(
		Dispatch(
			{},
			"1",
			ScaleBox,
			{Label Row( {Show Major Grid( 1 ), Show Minor Grid( 1 )} )}
		),
		Dispatch(
			{},
			"2",
			ScaleBox,
			{Label Row( {Show Major Grid( 1 ), Show Minor Grid( 1 )} )}
		)
	)
);

Right clicking on the generated chart and looking at the customize option does not give me desired options. 

Thanks.

 

When it's too good to be true, it's neither
1 ACCEPTED SOLUTION

Accepted Solutions
MathStatChem
Level VI

Re: How to have custom X-Y grid spacing in a plot?

Here is a modified script that does everything you want, except the adjusting the width of the grid lines

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Little Pond.jmp" );
cont_plot = dt << Contour Plot(
	X( :X, :Y ),
	Y( :Z ),
	Show Data Points( 0 ),
	Fill Areas( 0 ),
	Label Contours( 0 ),
	Transform( "Range Normalized" ),
	Specify Contours( Min( -4 ), Max( 8 ), N( 7 ) ),
);
report(cont_plot)[axis box(1)]<< show major grid(1);
report(cont_plot)[axis box(2)]<< show major grid(1);
report(cont_plot)[axis box(1)]<< inc(25);
report(cont_plot)[axis box(2)]<< inc(25);

report(cont_plot)[axis box(1)]<< Major Grid Line Color("red");
report(cont_plot)[axis box(2)]<< Major Grid Line Color("red");

I cannot see a way to adjust the thickness of the axis gridlines.  One hack to do this would be to add reference lines  the grid line levels.  

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Little Pond.jmp" );
cont_plot = dt << Contour Plot(
	X( :X, :Y ),
	Y( :Z ),
	Show Data Points( 0 ),
	Fill Areas( 0 ),
	Label Contours( 0 ),
	Transform( "Range Normalized" ),
	Specify Contours( Min( -4 ), Max( 8 ), N( 7 ) ),
);
for each({val}, 0::400::25, 
	report(cont_plot)[axis box(2)]<<Add Ref Line(val, "Solid", red, "", 3)
);
for each({val}, 0::150::25,
	report(cont_plot)[axis box(1)]<<Add Ref Line(val, "Solid", red, "", 3)
);

View solution in original post

1 REPLY 1
MathStatChem
Level VI

Re: How to have custom X-Y grid spacing in a plot?

Here is a modified script that does everything you want, except the adjusting the width of the grid lines

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Little Pond.jmp" );
cont_plot = dt << Contour Plot(
	X( :X, :Y ),
	Y( :Z ),
	Show Data Points( 0 ),
	Fill Areas( 0 ),
	Label Contours( 0 ),
	Transform( "Range Normalized" ),
	Specify Contours( Min( -4 ), Max( 8 ), N( 7 ) ),
);
report(cont_plot)[axis box(1)]<< show major grid(1);
report(cont_plot)[axis box(2)]<< show major grid(1);
report(cont_plot)[axis box(1)]<< inc(25);
report(cont_plot)[axis box(2)]<< inc(25);

report(cont_plot)[axis box(1)]<< Major Grid Line Color("red");
report(cont_plot)[axis box(2)]<< Major Grid Line Color("red");

I cannot see a way to adjust the thickness of the axis gridlines.  One hack to do this would be to add reference lines  the grid line levels.  

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Little Pond.jmp" );
cont_plot = dt << Contour Plot(
	X( :X, :Y ),
	Y( :Z ),
	Show Data Points( 0 ),
	Fill Areas( 0 ),
	Label Contours( 0 ),
	Transform( "Range Normalized" ),
	Specify Contours( Min( -4 ), Max( 8 ), N( 7 ) ),
);
for each({val}, 0::400::25, 
	report(cont_plot)[axis box(2)]<<Add Ref Line(val, "Solid", red, "", 3)
);
for each({val}, 0::150::25,
	report(cont_plot)[axis box(1)]<<Add Ref Line(val, "Solid", red, "", 3)
);