cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
statganda
Level I

Reference line

Dear community,

Is there any script that I can use to add different reference line to a multiple distribution chart. I have 4000 histograms & each one of them have different reference value.

Your help is really appreciated.

Thanks
1 ACCEPTED SOLUTION

Accepted Solutions
ms
Super User (Alumni) ms
Super User (Alumni)

Re: Reference line

Here is a sample script, assuming all histograms are within the same window. The individual ref lines are here simply the group mean, but the script can easily be adapted to a custom matrix or list of values, e.g. retrieved from a table

//Open datatable and make report
dt = Open( "$SAMPLE_DATA/Michelson.jmp" );

Biv = dt << Distribution(
	Continuous Distribution( Column( :Velocity ) ),
	By( :Trial# )
);
rbiv = Biv << Report();

// Here is created a list of all by-groups and a matrix with 
//means of each group to be used as a refline.
//A custom list can be used instead using the same approach 
Summarize(
	groups = by( :Trial# ),
	reflines = Mean( :Velocity )
); 
n = N Items( groups );

//Add reference lines
For( j = 1, j <= n, j++,
	rbiv[j][1][1][1][1][1][1][1][1] <<
	add ref line( reflines[j], solid, "Red" )
);

View solution in original post

10 REPLIES 10
ms
Super User (Alumni) ms
Super User (Alumni)

Re: Reference line

Here is a sample script, assuming all histograms are within the same window. The individual ref lines are here simply the group mean, but the script can easily be adapted to a custom matrix or list of values, e.g. retrieved from a table

//Open datatable and make report
dt = Open( "$SAMPLE_DATA/Michelson.jmp" );

Biv = dt << Distribution(
	Continuous Distribution( Column( :Velocity ) ),
	By( :Trial# )
);
rbiv = Biv << Report();

// Here is created a list of all by-groups and a matrix with 
//means of each group to be used as a refline.
//A custom list can be used instead using the same approach 
Summarize(
	groups = by( :Trial# ),
	reflines = Mean( :Velocity )
); 
n = N Items( groups );

//Add reference lines
For( j = 1, j <= n, j++,
	rbiv[j][1][1][1][1][1][1][1][1] <<
	add ref line( reflines[j], solid, "Red" )
);
statganda
Level I

Re: Reference line

Hi MS,

Thanks. It works.

More power to you
anneg
Level I

Re: Reference line

Hello,

 

I've got a similar problem, I have a graph and on the x-axis there is a date (like d.m.y), and I want several vertical ref lines on the a-axis. To day i used a script with v-line, but there I got the line, but no label on it.

 

The dates for the ref lines and the label are stored in a data table (column date (format d.m.y), column label). But the manual refline uses instead of the date a number like: 33962554400 (and I know this is a date...)

 

Graph Builder( Size( 696, 688 ), Show Control Panel( 0 ), Variables( X( :BL, Size( 212 ) ), Y( :Name( "x" ) ), Group Y( :Name( "s_-x" ) ), Overlay( :Projektklasse_plus ) ), Elements( Points( X, Y, Legend( 6 ) ) ), SendToReport( Dispatch( {}, "BL-date", ScaleBox, {Format( "d.m.y", 10 ), Interval( "Day" ), Inc( 1 ), Add Ref Line( 3396254400, Solid, {255, 0, 0}, "Label ref line 1" ) , Rotated Labels( 1 )} ), Dispatch(.......
 

 

my vline script was like this:

OPR[FrameBox(1)] << add graphics script (pen color("purple"); vline(column(data Table ("CHCharge$"),"CuI") << get values));

but actually i want really different ref lines with a label, on different dates and the data table with the dates for the ref lines is getting more and more dates in it throughout the year...

 

So can you please clarify your answer, how to use a data table?

 

Thanks in advance.

ms
Super User (Alumni) ms
Super User (Alumni)

Reference line

The strange number is JMPs internal representation of a datetime value (actually the nr of seconds since a reference date I keep forgetting...).

 

VLine() seems not to have an optional label argument. But you can populate the graph with vertical lines using Add ref line() in a for loop. Use Summarize() to get lists and matrices of the labels and dates from the data table. See example script below.

 

// Make example table
dt=New Table( "Test",
          Add Rows( 6 ),
          New Column( "Group",Nominal, Character, Set Values(
                              {"Group A", "Group A", "Group A", "Group B", "Group B", "Group B"})),
  New Column( "Data", Numeric,
                    Set Values( [1, 2, 3, 2, 3, 4] )),
  New Column( "Date", Numeric,
                    Format( "d-m-y", 12 ),
                    Set Values([3166214400, 3166300800, 3166387200, 3166214400, 3166300800, 3166387200])),
          New Column( "Label",Nominal,Character,
                    Set Values( {"A", "B", "C", "A", "B", "C"} )));
 
// Make list of dates and labels
Summarize(dlist=by(:Date),dlist=mean(:Date));
Summarize(llist=by(:Label));
 
// Make graph
gb=Graph Builder(
          Variables( X( :Date ), Y( :Data ), Overlay( :Group ) ),
          Elements( Points( X, Y, Legend( 1 ) ) ));
 
//Add vertical reflines based on dates in Column date
for(i=1,i<=nrows(dlist),i++,
report(gb)[Axis Box(1)] << add ref line (dlist[i],Solid, "Purple", llist[i] ));

I hope this helps.

anneg
Level I

Re: Reference line

It helped, but I still got an error,

 

I've got 2 different tables, one table I use for the graph, in the secon there are the dates (report "Verlauf Eta A6") and labels for ref lines (data table "")- I  changed allready the format to the jmp long date number:

for(i=1,i<=nrows(data Table ("Ereignisse")),i++, report("Verlauf ETA A6")[Axis Box(1)] << add ref line (column(data Table ("Ereignisse"),"Datum"),Solid, "Purple", column(data Table ("Ereignisse"),"Bezeichnung") ));

 but the Log returns the following (not very helpful)

In the following script, error marked by /*###*/ For( ::i = 1, ::i <= N Rows( Data Table( "Ereignisse" ) ), ::i++, Report( "Verlauf ETA A6" )[Axis Box( 1 )] <<  /*###*/ add ref line( Column( Data Table( "Ereignisse" ), "Datum" )[::i], Solid, "Purple", Column( Data Table( "Ereignisse" ), "Bezeichnung" )[::i] ) /*###*/ )
ms
Super User (Alumni) ms
Super User (Alumni)

Reference line

I am not sure what "Verlauf ETA A6" is for kind of Object. If it's a name of the graph bulider object it should work, however if it's the name of the data table it does not work. I think it is easier to assign a variable to the Graph builder window (as above

Besides that, it should work. I changed my script to retrieve the reflines from a separate table using your syntax and it worked.

I also think that you may need to make sure that the right table is the "current data table".

sfo
sfo
Level I

Re: Reference line

I have a similar problem. I have a proc gplot that is plotting 35 different charts for different id's using a by statement. Is there a way I can specify different horizontal reference line in each plot? And, is it also possible to display the value of that reference line either on top or bottom of the line?

Thanks

-JMP-
Level I

Re: Reference line

What does the following line of code do or mean?  How do I know how many [1]s are required?  The reason I ask is I want to be able to add ref line using variables in the ref line function properties.

 

rbiv[j][1][1][1][1][1][1][1][1]

 

txnelson
Super User

Re: Reference line

All platform displays have a tree structure behind them, which allows JSL to point to any particular object and to pass messages to the object.  If you go to any of the gray triangles in in an output display, and right click on it, and select "Show Tree Structure", you will see the objects.  You can reference them by selecting the offset to each object.  The

     

rbiv[j][1][1][1][1][1][1][1][1]

is an offset pointing to an AxisBox() in the display.  This coding is very cryptic.  I think if you examine the following code, you will see that what it is doing, is going through each of the 5 histogram ouputs, and finding the first axis box() in each of those displays, and passing the message to Add Reference Line.  It is the same as the cryptic notation, but in a form that branches by name to the object to be modified. 

//Open datatable and make report
dt = Open( "$SAMPLE_DATA/Michelson.jmp" );

Biv = dt << Distribution(
	Continuous Distribution( Column( :Velocity ) ),
	By( :Trial# )
);
rbiv = Biv << Report();

// Here is created a list of all by-groups and a matrix with 
//means of each group to be used as a refline.
//A custom list can be used instead using the same approach 
Summarize(
	groups = by( :Trial# ),
	reflines = Mean( :Velocity )
); 
n = N Items( groups );

//Add reference lines
For( j = 1, j <= n, j++,
	//rbiv[j][1][1][1][1][1][1][1][1] <<
	rbiv[j][AxisBox(1)]<<
	add ref line( reflines[j], solid, "Red" )
);

Jim