cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Have your say in shaping JMP's future by participating in the new JMP Wish List Prioritization Survey
Choose Language Hide Translation Bar
anne_sa
Level VI

Graph Builder: change width line of Parallel Plot when there is a Color variable

Hello everybody,

 

I do a Parallel Plot and I use a variable to color the lines. For example I use the following script with Big Class table:

 

obj = Graph Builder(
	Size( 636, 660 ),
	Variables( X( :height ), X( :weight, Position( 1 ) ), Color( :age ) ),
	Elements( Parallel( X( 1 ), X( 2 ), Legend( 3 ) ) )
);

Then I would like to modify the width of the line. I tried to run this:

frame = Report( obj )[FrameBox(1 )];
seg = frame << Find Seg( "Polyline Seg" );
seg << Set Line Width(3);

but it modified only the lines associated with the first level of my Color variable (age in this example).

 

How could I modify all lines simultaneously? Should I use the Dispatch function when I create the graph? However I don't really know how to handle it, since I do not know in advance the number of levels of the Color variable.

 

Thanks in advance for your help!

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
ms
Super User (Alumni) ms
Super User (Alumni)

Re: Graph Builder: change width line of Parallel Plot when there is a Color variable

Not sure why your code does not work as intended for you. It works for me (JMP 15 for Mac).

An alternative approach is to use Xpath. 

(obj << xpath( "//PolylineSeg" )) << Set Line Width( 3 );

 

View solution in original post

Thierry_S
Super User

Re: Graph Builder: change width line of Parallel Plot when there is a Color variable

Hi Ann,
Based on a couple of experiments I performed, I would like to first make sure that your problem is with the Legend on not the GB plot line themselves. If it is the case, I noticed that when you change the line width manually within the Customize menu, the legends are not updated correctly either. Hence, this seems to be a bug.
However, when you manually change the line width one by one in the Legend, both the curves and the Legend are updated.

The corresponding code (for one Legend item lifted from the GB script) is as follows:

 

obj << SendToReport( Dispatch( {}, "400", ScaleBox, {Legend Model (3, Properties (2, {Line Width (3)}, Itemd ID ("14", 1) ) )}));

So, to iterate through the Legend items (i.e. ages), I came up with the following "ugly" code:

 

 

Names Default to Here (1);

dt = current data table ();

dts = 	dt << Summary(
			Group( :age ),
			Freq( "None" ),
			Weight( "None" ),
			invisible
		);
	

dlist = Column (dts, "age") << get values;

Close (dts, NoSave);

show (dlist);

obj = dt << Graph Builder(
			Size( 636, 660 ),
			Variables( X( :height ), X( :weight, Position( 1 ) ), Color( :age ) ),
			Elements( Parallel( X( 1 ), X( 2 ), Legend( 3 ) ) )
);
objr = obj << report;
//frame = objr [FrameBox(1 )];                NO LONGER NEEDED
//seg = frame << Find Seg( "Polyline Seg" );  NO LONGER NEEDED
//seg << Set Line Width(6);                   NO LONGER NEEDED

For (i = 0, i < N Items (dlist), i++, 

	obj << SendToReport( Dispatch( {}, "400", ScaleBox, {Legend Model (3, Properties (i, {Line Width (12)}, Itemd ID (dlist [i], 1) ) )}))

);

 

 

Thierry R. Sornasse

View solution in original post

3 REPLIES 3
ms
Super User (Alumni) ms
Super User (Alumni)

Re: Graph Builder: change width line of Parallel Plot when there is a Color variable

Not sure why your code does not work as intended for you. It works for me (JMP 15 for Mac).

An alternative approach is to use Xpath. 

(obj << xpath( "//PolylineSeg" )) << Set Line Width( 3 );

 

Thierry_S
Super User

Re: Graph Builder: change width line of Parallel Plot when there is a Color variable

Hi Ann,
Based on a couple of experiments I performed, I would like to first make sure that your problem is with the Legend on not the GB plot line themselves. If it is the case, I noticed that when you change the line width manually within the Customize menu, the legends are not updated correctly either. Hence, this seems to be a bug.
However, when you manually change the line width one by one in the Legend, both the curves and the Legend are updated.

The corresponding code (for one Legend item lifted from the GB script) is as follows:

 

obj << SendToReport( Dispatch( {}, "400", ScaleBox, {Legend Model (3, Properties (2, {Line Width (3)}, Itemd ID ("14", 1) ) )}));

So, to iterate through the Legend items (i.e. ages), I came up with the following "ugly" code:

 

 

Names Default to Here (1);

dt = current data table ();

dts = 	dt << Summary(
			Group( :age ),
			Freq( "None" ),
			Weight( "None" ),
			invisible
		);
	

dlist = Column (dts, "age") << get values;

Close (dts, NoSave);

show (dlist);

obj = dt << Graph Builder(
			Size( 636, 660 ),
			Variables( X( :height ), X( :weight, Position( 1 ) ), Color( :age ) ),
			Elements( Parallel( X( 1 ), X( 2 ), Legend( 3 ) ) )
);
objr = obj << report;
//frame = objr [FrameBox(1 )];                NO LONGER NEEDED
//seg = frame << Find Seg( "Polyline Seg" );  NO LONGER NEEDED
//seg << Set Line Width(6);                   NO LONGER NEEDED

For (i = 0, i < N Items (dlist), i++, 

	obj << SendToReport( Dispatch( {}, "400", ScaleBox, {Legend Model (3, Properties (i, {Line Width (12)}, Itemd ID (dlist [i], 1) ) )}))

);

 

 

Thierry R. Sornasse
anne_sa
Level VI

Re: Graph Builder: change width line of Parallel Plot when there is a Color variable

Thanks @ms and @Thierry_S for your answers!

My objective is indeed to change the line width of the graph and not only of the legend.

I pick the solution of @ms since it is a bit shorter but both work like a charm!