- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
How can add another column of text to a graph?
For example, use "Big Class.jmp".
A text column has been added as follows.
And make a graph, the need to graph the new column text in the graph display.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << New Column( "row", formula( Row() ) );
dt << run formulas;
Column( "row" ) << deleteFormula;
dt << Add Multiple Columns( "A", 2, Character, "Nominal" );
Column( dt, N Col( dt ) - 1 ) << set name( "max" );
Column( dt, N Col( dt ) ) << set name( "min" );
Column( "max" ) << Formula(
If( height == Max( height[Index( Row() - 5, Row() + 5 )] ),
name
)
);
dt << run formulas;
Column( "max" ) << deleteFormula;
Column( "min" ) << Formula(
If( height == Min( height[Index( Row() - 5, Row() + 5 )] ),
name
)
);
dt << run formulas;Column( "min" ) << deleteFormula;
c1 = Graph Builder(
Size( 528, 456 ),
Show Control Panel( 0 ),
Variables( X( :row ), Y( :height ) ),
Elements( Line( X, Y, Legend( 5 ) ) )
);
Thanks Experts!
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How can add another column of text to a graph?
I think this is what you want. It creates the graph with only the Max column showing the labels, and then adds the Min column and the new labels show up.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt:name << set labelled( 0 ); // Remove the default label
// Create the new row column
dt << New Column( "row", formula( Row() ) );
dt << run formulas;
Column( "row" ) << deleteFormula;
// Add the first label column
dt << New Column( "max", character,
Formula(
If( height == Max( height[Index( Row() - 5, Row() + 5 )] ),
name
)
)
);
dt << run formulas;
Column( "max" ) << deleteFormula;
Column( "max" ) << set labelled( 1 );
dt << select where( :max != "" );
dt << Label;
dt << clear select;
// Run the graph
c1 = Graph Builder(
Size( 528, 456 ),
Show Control Panel( 0 ),
Variables( X( :row ), Y( :height ) ),
Elements( Line( X, Y, Legend( 5 ) ), Points( X, Y, Legend( 6 ) ) )
);
Report( c1 )[framebox( 1 )] << Marker Size( 0 );
// Wait added to allow initial labeling before adding new labeling
Wait( 5 );
// Add new label column
dt << New Column( "min", character,
Formula(
If( height == Min( height[Index( Row() - 5, Row() + 5 )] ),
name
)
)
);
dt << run formulas;
Column( "min" ) << deleteFormula;
Column( "min" ) << set labelled( 1 );
dt << select labeled;
dt << select where( :min != "", current selection( "extend" ) );
dt << Label;
dt << clear select;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How can add another column of text to a graph?
By setting the RowState color to red for the rows where there are Max values, the displayed labels for those rows will be red. I have added some code to the current script to handle the coloring.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt:name << set labelled( 0 ); // Remove the default label
// Create the new row column
dt << New Column( "row", formula( Row() ) );
dt << run formulas;
Column( "row" ) << deleteFormula;
// Add the first label column
dt << New Column( "max", character,
Formula(
If( height == Max( height[Index( Row() - 5, Row() + 5 )] ),
name
)
)
);
dt << run formulas;
Column( "max" ) << deleteFormula;
Column( "max" ) << set labelled( 1 );
dt << select where( :max != "" );
selectedRows = dt << get selected rows;
for(i=1,i<=NRows(selectedRows),i++,
rowstate( selectedRows[i] ) = Color State ("red")
);
dt<<select where(:max !="");
dt << Label;
dt << clear select;
// Run the graph
c1 = Graph Builder(
Size( 528, 456 ),
Show Control Panel( 0 ),
Variables( X( :row ), Y( :height ) ),
Elements( Line( X, Y, Legend( 5 ) ), Points( X, Y, Legend( 6 ) ) )
);
Report( c1 )[framebox( 1 )] << Marker Size( 0 );
// Wait added to allow initial labeling before adding new labeling
Wait( 5 );
// Add new label column
dt << New Column( "min", character,
Formula(
If( height == Min( height[Index( Row() - 5, Row() + 5 )] ),
name
)
)
);
dt << run formulas;
Column( "min" ) << deleteFormula;
Column( "min" ) << set labelled( 1 );
dt << select labeled;
dt << select where( :min != "", current selection( "extend" ) );
dt << Label;
dt << clear select;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How can I add another column of text to a graph?
I failed to find a solution through the graphic code of "Big Class Families".
Graph Builder(Size(535,455),
Variables(X(:row),Y(:height)),Elements(Line(X,Y,Legend(5))),
SendToReport(Dispatch({},"Graph Builder",FrameBox,
{Marker Size(2),{
Add Pin Annotation(Seg(Marker Seg(1)),Index(9),Index Row(9),UniqueID(1180683047),Origin({64.8386487250506,97.865127215503}),Offset({-239,8}),Tag Line)
}})));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How can I add another column of text to a graph?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How can add another column of text to a graph?
I think this is what you want. It creates the graph with only the Max column showing the labels, and then adds the Min column and the new labels show up.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt:name << set labelled( 0 ); // Remove the default label
// Create the new row column
dt << New Column( "row", formula( Row() ) );
dt << run formulas;
Column( "row" ) << deleteFormula;
// Add the first label column
dt << New Column( "max", character,
Formula(
If( height == Max( height[Index( Row() - 5, Row() + 5 )] ),
name
)
)
);
dt << run formulas;
Column( "max" ) << deleteFormula;
Column( "max" ) << set labelled( 1 );
dt << select where( :max != "" );
dt << Label;
dt << clear select;
// Run the graph
c1 = Graph Builder(
Size( 528, 456 ),
Show Control Panel( 0 ),
Variables( X( :row ), Y( :height ) ),
Elements( Line( X, Y, Legend( 5 ) ), Points( X, Y, Legend( 6 ) ) )
);
Report( c1 )[framebox( 1 )] << Marker Size( 0 );
// Wait added to allow initial labeling before adding new labeling
Wait( 5 );
// Add new label column
dt << New Column( "min", character,
Formula(
If( height == Min( height[Index( Row() - 5, Row() + 5 )] ),
name
)
)
);
dt << run formulas;
Column( "min" ) << deleteFormula;
Column( "min" ) << set labelled( 1 );
dt << select labeled;
dt << select where( :min != "", current selection( "extend" ) );
dt << Label;
dt << clear select;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How can add another column of text to a graph?
Thank Jim!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How can add another column of text to a graph?
How to use JSL to implement just will:the font for the "MAX" column is set to red.
Thanks Experts!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How can add another column of text to a graph?
By setting the RowState color to red for the rows where there are Max values, the displayed labels for those rows will be red. I have added some code to the current script to handle the coloring.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt:name << set labelled( 0 ); // Remove the default label
// Create the new row column
dt << New Column( "row", formula( Row() ) );
dt << run formulas;
Column( "row" ) << deleteFormula;
// Add the first label column
dt << New Column( "max", character,
Formula(
If( height == Max( height[Index( Row() - 5, Row() + 5 )] ),
name
)
)
);
dt << run formulas;
Column( "max" ) << deleteFormula;
Column( "max" ) << set labelled( 1 );
dt << select where( :max != "" );
selectedRows = dt << get selected rows;
for(i=1,i<=NRows(selectedRows),i++,
rowstate( selectedRows[i] ) = Color State ("red")
);
dt<<select where(:max !="");
dt << Label;
dt << clear select;
// Run the graph
c1 = Graph Builder(
Size( 528, 456 ),
Show Control Panel( 0 ),
Variables( X( :row ), Y( :height ) ),
Elements( Line( X, Y, Legend( 5 ) ), Points( X, Y, Legend( 6 ) ) )
);
Report( c1 )[framebox( 1 )] << Marker Size( 0 );
// Wait added to allow initial labeling before adding new labeling
Wait( 5 );
// Add new label column
dt << New Column( "min", character,
Formula(
If( height == Min( height[Index( Row() - 5, Row() + 5 )] ),
name
)
)
);
dt << run formulas;
Column( "min" ) << deleteFormula;
Column( "min" ) << set labelled( 1 );
dt << select labeled;
dt << select where( :min != "", current selection( "extend" ) );
dt << Label;
dt << clear select;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How can add another column of text to a graph?
How can I modify the interval markers to use different colors?
Big Class.jmp uses this script to plot, "B" lists the height values of different ages by the number of rows to start and end.
The "B" column data that needs to be marked with the value of this B column as the interval, but requires the number of rows at the end of the age, is marked in red.
Thank Jim!
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Sort( By( age ), Order( Ascending ), replace table );
ca = "B";
r = N Row( dt );
New Column( ca );
Column( ca ) << Formula( If( Row() == r | Row() == 1 | age != Lag( age, 1 ) | age != Lag( age, -1 ), height ) );
dt << run formulas;
Column( ca ) << deleteFormula;
p1 = dt << Graph Builder(
Variables( X( :weight ), Y( :height ), Group X( :age ), Color( :sex ), Interval( :B ) ),
Elements( Bar( X, Y, Legend( 7 ), Response Axis( "X" ) ) )
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How can add another column of text to a graph?
By default, in JMP 17, the error bars take on the color specified by the "Color" variable. In previous versions, the color was only determined by the color setting in the Customize Graph window. However, only one color can be used. Therefore, if you set the Error Bar color to Red, both the error bars for M and F would be red.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How can add another column of text to a graph?
OK、Thank Jim!