Community Trekker

Joined:

Dec 19, 2012

## 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?

Jerome

1 ACCEPTED SOLUTION

Accepted Solutions

Staff

Joined:

Jun 23, 2011

Solution

## 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 ) ) ),

);

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 )]

// 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 );

);

);

2 REPLIES

Staff

Joined:

Jun 23, 2011

Solution

## 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 ) ) ),

);

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 )]

// 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 );

);

);

Community Trekker

Joined:

Dec 19, 2012

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

Exactly what I needed, thanks Ian!