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" ) );
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.
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.
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] ) /*###*/ )
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