cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
New to using JMP? Hit the ground running with the Early User Edition of Discovery Summit. Register now, free of charge.
Register for our Discovery Summit 2024 conference, Oct. 21-24, where you’ll learn, connect, and be inspired.
Choose Language Hide Translation Bar
hogi
Level XI

Graph Builder. Combine Smoother and Line - how?

I have groups of measurement that I want to plot "together". 

The individual measurement curves of a group should have the same color and be semi-transparent.
For each group there should be an additional smoother curve with the same color.

 

Is this possible in Jmp? - without "workarounds"?

 

version 1:

  • measurements of one groups have same color
  • one curve per measurement
  • transparency works
  • 1 smoother line instead of 3
  • the smoother curve doesn't have the "right" color [consequential error]

hogi_2-1689325538795.png

version 2:

  • measurements of one groups have same color
  • nasty jumps back for the individual curves
  • transparency works
  • each group has it's own smoother curve
  • smoother curves have has the wrong color

 

hogi_1-1689325503986.png

 

 

dt =Open( "$SAMPLE_DATA/Functional Data/Weekly Weather Data.jmp" );
dt << New Column( "group",Character,"Nominal",Formula( Substr( :STATION, 8, 1 ) ));

//version 1
dt << Graph Builder(
	Variables(
		X( :DATE ),
		Y( :TAVG ),
		Overlay( :STATION ),
		Color( :group )
	),
	Elements(
		Line( X, Y, Legend( 31 ) ),
		Smoother( X, Y, Overlay( 0 ), Legend( 32 ) )
	),
	SendToReport(
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model(
				31,
				Properties( 0, {Transparency( 0.2 )}, Item ID( "2", 1 ) ),
				Properties( 1, {Transparency( 0.2 )}, Item ID( "3", 1 ) ),
				Properties( 2, {Transparency( 0.2 )}, Item ID( "4", 1 ) )
			)}
		)
	)
	
);


//version 2
dt << Graph Builder(
	Variables( X( :DATE ), Y( :TAVG ), Overlay( :group ), Color( :group ) ),
	Elements(
		Line( X, Y, Legend( 31 ), Row order( 1 ) ),
		Smoother( X, Y, Legend( 32 ) )
	),
	SendToReport(
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model(
				31,
				Properties( 0, {Transparency( 0.2 )}, Item ID( "2", 1 ) ),
				Properties( 1, {Transparency( 0.2 )}, Item ID( "3", 1 ) ),
				Properties( 2, {Transparency( 0.2 )}, Item ID( "4", 1 ) )
			)}
		)
	)
)

 

1 ACCEPTED SOLUTION

Accepted Solutions
hogi
Level XI

Re: Graph Builder. Combine Smoother and Line - how?

TillGraph Builder - Overlay by multiple columns  or Graph Builder: Line - possibility to add breaks   becomes available,

you can use this workaround:

add dummy rows with missing x / y value and select no connection for missing values.

hogi_0-1689433692693.png

 

version 3:

  • same group = same color
  • no nasty zig-zag curves
  • transparency works
  • each group has it's own smoother curve
  • smoother curves with matching color
  • new rows added to the data table

hogi_1-1689433848246.png

 

dt =Open( "$SAMPLE_DATA/Functional Data/Weekly Weather Data.jmp" );
dt << New Column( "group",Character,"Nominal",Formula( Substr( :STATION, 8, 1 ) ));

//version 3
stations = dt << Summary(Group( :STATION, :NAME ));
For EACH({station}, stations[0,0], dt << add row({:STATION=station[1],:NAME=station[2]})); 
dt << sort( BY(:NAME, :DATE ), Replace Table);

dt << Graph Builder(
	Variables( X( :DATE ), Y( :TAVG ), Overlay( :group ) ),
	Elements(
		Line( X, Y, Legend( 1 ), Row order( 1 ), Missing Values( "No Connection" ) ),
		Smoother( X, Y, Legend( 2 ) )
	),
	SendToReport(
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model(
				1,
				Properties( 0, {Transparency( 0.3 )}, Item ID( "2", 1 ) ),
				Properties( 1, {Transparency( 0.3 )}, Item ID( "3", 1 ) ),
				Properties( 2, {Transparency( 0.3 )}, Item ID( "4", 1 ) )
			), Legend Model(
				2,
				Base( 0, 0, 0, Item ID( "2", 1 ) ),
				Base( 1, 0, 0, Item ID( "3", 1 ) ),
				Base( 2, 0, 0, Item ID( "4", 1 ) )
			)}
		)
	)
)

 

#1000

View solution in original post

7 REPLIES 7
jthi
Super User

Re: Graph Builder. Combine Smoother and Line - how?

Try removing group from color for smoother and to remove zigzag disable Row order

jthi_0-1689326214527.png

 

-Jarmo
hogi
Level XI

Re: Graph Builder. Combine Smoother and Line - how?

Ah, the Color = "Group" is just too much. It can be removed completely.

 

concerning Zig-Zag:
I want to have separate curves per station, this is why I enabled row order

Disabling the option leads to one combined curve for all stations of a group.

 

version 2 (b):

  • measurements of one group have same color
  • nasty jumps back for the individual curves (fixed by removing row order)
    unfortunately not anymore: one curve per station
  • transparency works
  • each group has it's own smoother curve
  • smoother curves with matching color 

hogi_2-1689326899601.png

hogi
Level XI

Re: Graph Builder. Combine Smoother and Line - how?

I hope somebody finds a way to get this graph created in Jmp (17)  - without adding new rows and columns to the graph.

 

Overlay by multiple column will solve the problem. If Overlay accepts more than one column, the user can select different Overlays for the two plot types:

 

  1. Overlay for the smoother element:
    :group-> one fit curve per group

  2. Overlay for the line element:
    :Station -> separate traces per station =  no zig-zag lines

 

Besides enhancing the Overlay functionality , here is another wishGraph Builder: Line - possibility to add breaks which uses a simple trick to add the breaks:
The idea: a measurement trace runs from left to right.
Each step from right to left marks the start of a new trace -> add a break.

hogi_0-1725209526019.png

hogi
Level XI

Re: Graph Builder. Combine Smoother and Line - how?

TillGraph Builder - Overlay by multiple columns  or Graph Builder: Line - possibility to add breaks   becomes available,

you can use this workaround:

add dummy rows with missing x / y value and select no connection for missing values.

hogi_0-1689433692693.png

 

version 3:

  • same group = same color
  • no nasty zig-zag curves
  • transparency works
  • each group has it's own smoother curve
  • smoother curves with matching color
  • new rows added to the data table

hogi_1-1689433848246.png

 

dt =Open( "$SAMPLE_DATA/Functional Data/Weekly Weather Data.jmp" );
dt << New Column( "group",Character,"Nominal",Formula( Substr( :STATION, 8, 1 ) ));

//version 3
stations = dt << Summary(Group( :STATION, :NAME ));
For EACH({station}, stations[0,0], dt << add row({:STATION=station[1],:NAME=station[2]})); 
dt << sort( BY(:NAME, :DATE ), Replace Table);

dt << Graph Builder(
	Variables( X( :DATE ), Y( :TAVG ), Overlay( :group ) ),
	Elements(
		Line( X, Y, Legend( 1 ), Row order( 1 ), Missing Values( "No Connection" ) ),
		Smoother( X, Y, Legend( 2 ) )
	),
	SendToReport(
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model(
				1,
				Properties( 0, {Transparency( 0.3 )}, Item ID( "2", 1 ) ),
				Properties( 1, {Transparency( 0.3 )}, Item ID( "3", 1 ) ),
				Properties( 2, {Transparency( 0.3 )}, Item ID( "4", 1 ) )
			), Legend Model(
				2,
				Base( 0, 0, 0, Item ID( "2", 1 ) ),
				Base( 1, 0, 0, Item ID( "3", 1 ) ),
				Base( 2, 0, 0, Item ID( "4", 1 ) )
			)}
		)
	)
)

 

#1000

hogi
Level XI

Re: Graph Builder. Combine Smoother and Line - how?

@XanGregg , will Overlay Encoding facilitate the creation of such plots (different color and individual fit curves for different variants - but more than one measurement curve per variant).

hogi
Level XI

Re: Graph Builder. Combine Smoother and Line - how?

And Configure Levels?
no: again the zig-zag lines.

 

hogi_1-1725211431688.png

 

View more...
dt =Open( "$SAMPLE_DATA/Functional Data/Weekly Weather Data.jmp" );
Graph Builder(
	Transform Column(
		"STATION'",
		Character,
		Set Property( "Configure Levels", 1 ),
		Formula(
			Map Value(
				:STATION,
				{"USW00092811", "USW00012924", "USW00014922", "USW00014751",
				"USW00024024", "USW00014751", "USW00024144", "USW00014751",
				"USW00094626", "USW00014751", "USW00003868", "USW00003195",
				"USW00003949", "USW00003195", "USW00013733", "USW00003195",
				"USW00013877", "USW00003195", "USW00053182", "USW00003195",
				"USW00093067", "USW00003195", "USW00093242", "USW00003195",
				"USW00093718", "USW00003195"},
				Unmatched( :STATION )
			)
		)
	),
	Variables( X( :DATE ), Y( :TAVG ), Overlay( :STATION' ) ),
	Elements(
		Line( X, Y, Legend( 1 ), Row order( 1 ), Missing Values( "No Connection" ) ),
		Smoother( X, Y, Legend( 2 ) )
	)
)
hogi
Level XI

Re: Graph Builder. Combine Smoother and Line - how?

If you generate such plots regularly, please have a look at QuickSelect Toolbar .
There is a Shortcut Icon to create the dummy rows automatically and to sort the table to put the dummy rows in the right position.

 

hogi_4-1725212238363.png