Choose Language Hide Translation Bar
Highlighted
Thierry_S
Community Trekker

Graph Builder: How to Center Align Violin Plots with Points and Overlay Switched on?

Hi JMP community,

 

I just ran into a slightly frustrating issue with Graph Builder:

  • X axis 1: LEAD TAG
  • X axis 2: SWITCH TO
  • Y axis: Log2 Ratio After/before
  • Overlay: LEAD TAG
  • POINTS: ON
  • CONTOUR: ON
  • LINE: ON (mean + Std Err)

I have almost what I want (see below) but the Violon plots are aligned left for the first group, middle for the second group, and right for the last group. Any trick to get this odd behavior corrected (i.e. all Violin plots aligned to the middle?)

GB 2 X axis Base X as Overlay Points Violin and Line ON.png

Note: If I do not use LEAD TAG as an Overly variable, I can align the Violin plots correctly but then I have a a problem with the Line: linked across LEAD TAG groups (see below).

 

GB 2 X axis No Overlay Points Violin and Line ON.png

Any suggestions would be highly appreciated.

 

Thanks

 

TS

 

Thierry R. Sornasse
0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
gzmorgan0
Super User

Re: Graph Builder: How to Center Align Violin Plots with Points and Overlay Switched on?

This misalignment of points and other graph builder elements has been documented previously. I think there was agreement that the easiest method was to live without the violin plots being colored, otherwise customize the contour violins.  Here is a script for Big Class.

 

Names Default to Here(1);

dt = Open("$Sample_Data/Big Class.jmp");

gb = dt << Graph Builder(
    show control panel(0),
	Variables( X( :age ), X( :sex, Position( 1 ) ), Y( :height ), Color( :age ) ),
	Elements(
		Points( X( 1 ), X( 2 ), Y, Legend( 6 ) ),
		Contour( X( 1 ), X( 2 ), Y, Legend( 7 ) )
	),
	SendToReport(
		Dispatch( {}, "age", ScaleBox, {Label Row( 2, Show Major Grid( 1 ) )} ),
		Dispatch(
			{},
			"Graph Builder",
			FrameBox,
			{DispatchSeg(
				Poly Seg( "Violin (13>>F)" ),
				{Transparency( 0.4 ), Fill Color( "Medium Dark Red" )}
			), DispatchSeg(
				Poly Seg( "Violin (13>>M)" ),
				{Transparency( 0.4 ), Fill Color( "Medium Dark Red" )}
			), DispatchSeg(
				Poly Seg( "Violin (14>>F)" ),
				{Transparency( 0.4 ), Fill Color( "Medium Dark Green" )}
			), DispatchSeg(
				Poly Seg( "Violin (14>>M)" ),
				{Transparency( 0.4 ), Fill Color( "Medium Dark Green" )}
			), DispatchSeg(
				Poly Seg( "Violin (15>>F)" ),
				{Transparency( 0.4 ), Fill Color( "Medium Dark Purple" )}
			), DispatchSeg(
				Poly Seg( "Violin (15>>M)" ),
				{Transparency( 0.4 ), Fill Color( "Medium Dark Purple" )}
			), DispatchSeg(
				Poly Seg( "Violin (16>>F)" ),
				{Transparency( 0.4 ), Fill Color( "Orange" )}
			), DispatchSeg(
				Poly Seg( "Violin (17>>M)" ),
				{Transparency( 0.4 ), Fill Color( "BlueCyan" )}
			)}
		)
	)
);

 

View solution in original post

0 Kudos
1 REPLY 1
gzmorgan0
Super User

Re: Graph Builder: How to Center Align Violin Plots with Points and Overlay Switched on?

This misalignment of points and other graph builder elements has been documented previously. I think there was agreement that the easiest method was to live without the violin plots being colored, otherwise customize the contour violins.  Here is a script for Big Class.

 

Names Default to Here(1);

dt = Open("$Sample_Data/Big Class.jmp");

gb = dt << Graph Builder(
    show control panel(0),
	Variables( X( :age ), X( :sex, Position( 1 ) ), Y( :height ), Color( :age ) ),
	Elements(
		Points( X( 1 ), X( 2 ), Y, Legend( 6 ) ),
		Contour( X( 1 ), X( 2 ), Y, Legend( 7 ) )
	),
	SendToReport(
		Dispatch( {}, "age", ScaleBox, {Label Row( 2, Show Major Grid( 1 ) )} ),
		Dispatch(
			{},
			"Graph Builder",
			FrameBox,
			{DispatchSeg(
				Poly Seg( "Violin (13>>F)" ),
				{Transparency( 0.4 ), Fill Color( "Medium Dark Red" )}
			), DispatchSeg(
				Poly Seg( "Violin (13>>M)" ),
				{Transparency( 0.4 ), Fill Color( "Medium Dark Red" )}
			), DispatchSeg(
				Poly Seg( "Violin (14>>F)" ),
				{Transparency( 0.4 ), Fill Color( "Medium Dark Green" )}
			), DispatchSeg(
				Poly Seg( "Violin (14>>M)" ),
				{Transparency( 0.4 ), Fill Color( "Medium Dark Green" )}
			), DispatchSeg(
				Poly Seg( "Violin (15>>F)" ),
				{Transparency( 0.4 ), Fill Color( "Medium Dark Purple" )}
			), DispatchSeg(
				Poly Seg( "Violin (15>>M)" ),
				{Transparency( 0.4 ), Fill Color( "Medium Dark Purple" )}
			), DispatchSeg(
				Poly Seg( "Violin (16>>F)" ),
				{Transparency( 0.4 ), Fill Color( "Orange" )}
			), DispatchSeg(
				Poly Seg( "Violin (17>>M)" ),
				{Transparency( 0.4 ), Fill Color( "BlueCyan" )}
			)}
		)
	)
);

 

View solution in original post

0 Kudos