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

How to use different labels for the same bar chart?

Positive and negative values like this use different cotton swabs

Thanks!

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
r = N Row( dt );ca = "weight";ar = dt << GetAsMatrix( ca );
For( i = 1, i <= r, i++,	ar[i, 1] = -ar[i, 1]);dt[0, ca] = ar;
c1 = Quantile( 0.8, dt[0, "height"] );c2 = Quantile( 0.2, dt[0, "weight"] );
ca = "A";New Column( ca );Column( ca ) << Formula( If( height > c1, height ) );dt << run formulas;Column( ca ) << deleteFormula;
ca = "B";New Column( ca );Column( ca ) << Formula( If( weight < c2, weight ) );dt << run formulas;Column( ca ) << deleteFormula;
Column( "A" ) << set labelled( 1 );
Column( "B" ) << set labelled( 1 );
Column( "name" ) << set labelled( 0 );
p1 = dt << Graph Builder(
	Size( 885, 607 ),
	Variables( X( Transform Column( "Row", Formula( Row() ) ) ), Y( :height ), Y( :weight, Position( 1 ) ) ),
	Elements( Bar( X, Y( 1 ), Y( 2 ), Legend( 5 ), Bar Style( "Stacked" ), Label( "Label by Row" ) ) ),
	SendToReport(
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model(
				5,
				Properties( 0, {Transparency( 0.5 )}, Item ID( "height", 1 ) ),
				Properties( 1, {Transparency( 0.5 )}, Item ID( "weight", 1 ) )
			)}
		)
	)
);

2024-10-19_21-46-00.png

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: How to use different labels for the same bar chart?

You could for example add extra bar charts for A and B columns and set labels for those (disable columns from variables accordingly and set transparency of second bar charts to 0)

jthi_1-1729347436917.png

I think you can also use Points instead of bars in JMP18 if you want to

-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User

Re: How to use different labels for the same bar chart?

You could for example add extra bar charts for A and B columns and set labels for those (disable columns from variables accordingly and set transparency of second bar charts to 0)

jthi_1-1729347436917.png

I think you can also use Points instead of bars in JMP18 if you want to

-Jarmo