cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • See how to interactively organize and restructure data for analysis. Register for May 29 webinar, 2pm US ET.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
j_bonnouvrier
Level III

How to modify marker size depending on a column value

In the very simple exemple enclosed, in the graph builder chart saved in the table, I would loke to increase marker size for "Label == C".

Is there any simple solution to do that?

Thanks in advance!

Jerome

1 ACCEPTED SOLUTION

Accepted Solutions
ian_jmp
Level X

Re: How to modify marker size depending on a column value

Graph Builder has a 'Size' drop zone, which controls the marker sizes for different levels of a variable.

But if that doesn't give you what you want, you can alternatively use markers defined by row states, and then add a graphics script to manipulate marker size.

Names Default To Here( 1 );

// Make a table

dt = New Table( "Test Marker Size",

New Column( "X", Numeric, Continuous, Formula( Random Normal() ) ),

New Column( "Y", Numeric, Continuous, Formula( Random Normal() ) ),

New Column( "Label", Numeric, Nominal, Formula( Random Integer( 3 ) ) ),

AddRows( 20 )

);

dt << runFormulas;

// Assign default markers and colours

dt << ColorByColumn( :Label );

// Graph Builder

gb = dt << Graph Builder( Variables( X( :X ), Y( :Y ) ), Elements( Points( X, Y, Legend( 5 ) ) ) );

Wait( 3 );

// Add graphics script

Report( gb )[FrameBox( 1 )]

<< AddGraphicsScript(

// Plot over the markers with bigger ones when 'Label' is 3

dt = Data Table( "Test Marker Size" );

r3 = dt << getRowsWhere( :Label == 3 );

For( r = 1, r <= N Rows( r3 ), r++,

x3 = Column( dt, "X" )[r3[r]];

y3 = Column( dt, "Y" )[r3[r]];

ms3 = Combine States(

Marker State( Marker Of( Row State( r3[r] ) ) ),

Color State( Color Of( Row State( r3[r] ) ) )

);

Marker( ms3, {x3, y3} );

Marker Size( 10 );

);

);

View solution in original post

2 REPLIES 2
ian_jmp
Level X

Re: How to modify marker size depending on a column value

Graph Builder has a 'Size' drop zone, which controls the marker sizes for different levels of a variable.

But if that doesn't give you what you want, you can alternatively use markers defined by row states, and then add a graphics script to manipulate marker size.

Names Default To Here( 1 );

// Make a table

dt = New Table( "Test Marker Size",

New Column( "X", Numeric, Continuous, Formula( Random Normal() ) ),

New Column( "Y", Numeric, Continuous, Formula( Random Normal() ) ),

New Column( "Label", Numeric, Nominal, Formula( Random Integer( 3 ) ) ),

AddRows( 20 )

);

dt << runFormulas;

// Assign default markers and colours

dt << ColorByColumn( :Label );

// Graph Builder

gb = dt << Graph Builder( Variables( X( :X ), Y( :Y ) ), Elements( Points( X, Y, Legend( 5 ) ) ) );

Wait( 3 );

// Add graphics script

Report( gb )[FrameBox( 1 )]

<< AddGraphicsScript(

// Plot over the markers with bigger ones when 'Label' is 3

dt = Data Table( "Test Marker Size" );

r3 = dt << getRowsWhere( :Label == 3 );

For( r = 1, r <= N Rows( r3 ), r++,

x3 = Column( dt, "X" )[r3[r]];

y3 = Column( dt, "Y" )[r3[r]];

ms3 = Combine States(

Marker State( Marker Of( Row State( r3[r] ) ) ),

Color State( Color Of( Row State( r3[r] ) ) )

);

Marker( ms3, {x3, y3} );

Marker Size( 10 );

);

);

j_bonnouvrier
Level III

Re: How to modify marker size depending on a column value

Exactly what I needed, thanks Ian!

Recommended Articles