cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
hogi
Level XIII

Time binning - how to change the Tick labels?

Among other  , the new Time Bin (&Wrap) option is extremely useful:
Continuous values are binned and represented as ordinal values. [edited]

 

hogi_0-1717775636621.png

 

The only issue:
The axis and grid look a bit chaotic:

hogi_5-1717775960472.png

 

I'd prefer a more structured view like this one  - with long divider and lower frame:

hogi_6-1717776081956.png

 

but the settings for Tick labels and grids:
hogi_2-1717775754495.png


... are  missing in the GUI for Axis with Time Bin settings:

hogi_3-1717775857585.png

 

Why?

6 REPLIES 6
jthi
Super User

Re: Time binning - how to change the Tick labels?

Have you made sure your columns are nominal/ordinal (I think tick labels are for categorical variables)?

https://www.jmp.com/support/help/en/18.0/index.shtml#page/jmp/customize-axes-and-axis-labels-in-grap...

 

 

-Jarmo
hogi
Level XIII

Re: Time binning - how to change the Tick labels?

You are right, besides being quite "ordinal", the values stay "continuous" - displayed on a continuous time scale.

 

I would say: tick labels are for continuous variables as well:

hogi_1-1717783793755.png

 

... but quite unfortunately, the cool tick label settings to adjust the graph are missing.

 

So, the only way it to manually change the modeling type to ordinal/nominal of the created transform column.

But then:
- I lose the Label row nesting functionality

:(- months with missing data will just be removed from the plot ( at least till:folded_hands: Column Property: Inclusive Values  is available ...) (*)

At the moment, I think the only way is:

generate Year and month manually as ordinal values and then nest them on the x axis. [with issue (*)]

right?

jthi
Super User

Re: Time binning - how to change the Tick labels?

It seems like that is the only option you currently have (I haven''t tried if you could force those by scripting).

-Jarmo
hogi
Level XIII

Re: Time binning - how to change the Tick labels?

For some seconds I thought that going via Time Bin could fix the issue with the too dynamic adjustment of the tick spacing in Graph builder: Heatmap - option: fixed Tick spacing (aggregation area) .
But clear: if it's just a transform column - and there is still the continuous axis scale, which is affected by the rescale bug.

hogi
Level XIII

Re: Time binning - how to change the Tick labels?

An Issue (1): 
The below code generates a graph like this:

hogi_0-1717848274119.png

 

Unfortunately the

Date Increment(., "Week", 0) = 01Jan0000;

ruins the scale on the x axis.

 

Open( "$SAMPLE_DATA/Aircraft Incidents.jmp" );

:Event Date[1] = .;

Graph Builder(
	Transform Column(
		"Week[Event Date]",
		Format( "Format Pattern", "<MM></><DD></><YYYY>", 15 ),
		Formula( Date Increment( :Event Date, "Week", 0 ) )
	),
	Variables( X( :"Week[Event Date]"n ) ),
	Elements( Bar( X, Legend( 4 ) ) )
);

 

... so, one has to fix the formula manually via 

If(is missing(:Event Date), ., Date Increment( :Event Date, "Week", 0 ))
hogi
Level XIII

Re: Time binning - how to change the Tick labels?

If the user wants to bin by week - to get Plots for Year & week, there is another issue (#2):

 

by default, JMP creates the binned date with the format DD / MM / YYYY.

So, instead of week, still dates (with day and month) is used up as axis labels.

 

So, how to tell JMP that the week should be used.
Plan A: 
- adjust the Format of the current axis - to use Week instead of day and month. and indeed, it works - but the user has to do the job for every single plot he wants to adjust.

 

Better:
The user can directy change the Format of the column (see code below) - then the week also gets into the axis labels:

hogi_2-1717851678064.png

 

even cooler: If the user enables nesting on the axis, JMP automatically shows the week AND the year - nested.

 

but wait - label nesting seems to have an issue with ISO Dates , Argh !!!

hogi_0-1717851022835.png

 

Why does the center plot show 2022 instead of 2023?!??!

Converting Week and Week2 to Format "Best" shows: both columns have the same entries. So, it's not an issue of the column, right?

New Table( "test",
	Add Rows( 2 ),
	Compress File When Saved( 1 ),
	New Column( "date",
		Format( "d/m/y", 10 ),
		Set Values( [3768422400, 3797366400] )
	),
New Column( "Week[date]",
	Format( "Format Pattern", "<yyyy> cw<ww>", 15 ),
	Formula( Date Increment( :date, "Week", 0 ) )
),
New Column( "Week[date]_2",
	Format( "Format Pattern", "<DD>.<MM>.<YYYY>", 15 ),
	Formula( Date Increment( :date, "Week", 0 ) )
)
);

Graph Builder(
	Variables( X( :date ), X( :"Week[date]"n ),X( :"Week[date]_2"n ) ),
	Elements( Position( 1, 1 ), Points( X ) ),
	Elements( Position( 2, 1 ), Points( X ) ),
	Elements( Position( 3, 1 ), Points( X ) ),
	SendToReport(
		Dispatch( {}, "date", ScaleBox, {Label Row Nesting( 2 )} ),
		Dispatch( {}, "Week[date]", ScaleBox, {Label Row Nesting( 2 )} ),
		Dispatch( {}, "Week[date]_2", ScaleBox, {Label Row Nesting( 2 )} )
	)
); 


-> some improvements + bugfixes for nested binned time/date axes 

Recommended Articles