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

How to change the color of many histogram distributions?

Hi,

I am plotting 64 histogram distributions and stack them together. I like to change the color of each histogram different. You can manually do this but how one can change this automatically?

 

I appreciate your help. Thanks

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How to change the color of many histogram distributions?

The Histogram Color is programatically available to JSL.  You can fairly easily write a script to do this.  Here is the result of just using Customize and then having the platform generate the script for the modification

Distribution(
	Stack( 1 ),
	Continuous Distribution(
		Column( :height ),
		Horizontal Layout( 1 ),
		Vertical( 0 )
	),
	Continuous Distribution(
		Column( :weight ),
		Horizontal Layout( 1 ),
		Vertical( 0 )
	),
	SendToReport(
		Dispatch(
			{"height"},
			"Distrib Histogram",
			FrameBox,
			{DispatchSeg(
				Hist Seg( 1 ),
				{Line Color( {108, 60, 65} ), Fill Color( "Medium Light Green" )}
			)}
		),
		Dispatch(
			{"weight"},
			"Distrib Histogram",
			FrameBox,
			{DispatchSeg(
				Hist Seg( 1 ),
				{Line Color( {108, 60, 65} ), Fill Color( "Red" )}
			)}
		)
	)
);
Jim

View solution in original post

4 REPLIES 4
txnelson
Super User

Re: How to change the color of many histogram distributions?

The Histogram Color is programatically available to JSL.  You can fairly easily write a script to do this.  Here is the result of just using Customize and then having the platform generate the script for the modification

Distribution(
	Stack( 1 ),
	Continuous Distribution(
		Column( :height ),
		Horizontal Layout( 1 ),
		Vertical( 0 )
	),
	Continuous Distribution(
		Column( :weight ),
		Horizontal Layout( 1 ),
		Vertical( 0 )
	),
	SendToReport(
		Dispatch(
			{"height"},
			"Distrib Histogram",
			FrameBox,
			{DispatchSeg(
				Hist Seg( 1 ),
				{Line Color( {108, 60, 65} ), Fill Color( "Medium Light Green" )}
			)}
		),
		Dispatch(
			{"weight"},
			"Distrib Histogram",
			FrameBox,
			{DispatchSeg(
				Hist Seg( 1 ),
				{Line Color( {108, 60, 65} ), Fill Color( "Red" )}
			)}
		)
	)
);
Jim
AT
AT
Level V

Re: How to change the color of many histogram distributions?

Thanks Jim. Does it mean I have to do this for 64 Histograms that I want to build and stack them together?

txnelson
Super User

Re: How to change the color of many histogram distributions?

The simple answer is yes......however, using a For() loop and Substitution you can just loop through the 64 histograms you want and generate the necessary code

Jim
AT
AT
Level V

Re: How to change the color of many histogram distributions?

Thanks Jim. I will give it a try.