Choose Language Hide Translation Bar
Highlighted
shaira
Level IV

FrameBox Error Occurs when By Function is added in Bivariate Plot Script

I have a script for plotting which works. I added the "By" function and it no longer works.

The error message is 

 FrameBox in access or evaluation of 'FrameBox' 

Here is the original working script before modification.

CodeBlk=Expr(
	 colname = {"Column1", "Column2", "Column3"};
	 colabrv = {};
	 For (i=1, i<=Nitems(colname), i++, colabrv=Insert(colabrv,"Var"||Char(i)));
	 all_col = dtable << get column names( string );
	 If(!Contains(all_col, "Column_Grp"),
	 dtable << New Column ("Column_Grp",
Formula(If(:Tester_MD=="Tester1", "Tester1", "Other Testers"))); ); New Window("GRAPHS", Lineup Box(Ncol(2), For( n = 1, n <= Nitems(colname), n++, plotswp = "current data table(subdt);" ||
colabrv[n]||"_Max = col quantile( :Name( \!"" || colname[n] ||"\!" ), 0.5 )+(2*col Std Dev( :Name( \!"" || colname[n] ||"\!" ) ));"||
colabrv[n]||"_Min = col quantile( :Name( \!""||colname[n]||"\!" ), 0.5 )-
(2*col Std Dev( :Name( \!"" || colname[n] ||"\!" ) ));" ||
colabrv[n] || "_Step = Std Dev( :Name( \!""|| colname[n] || "\!" ) );" || "current data table(dtable);" ||
colabrv[n] ||"_Plot = Bivariate (Y( :Name( \!"" || colname[n] ||"\!" ) ),
X( :Name( \!"XColumn\!" ) ),group by (groupcol),
Fit Spline(1000));"; For( c = 1, c <= GroupListN, c++,
If(Right( GroupList[c], 3 ) == "OFF",
plotswp = plotswp || colabrv[n] ||"_Plot << (Curve[" || Char( c ) ||"]
<< Line Style( Dashed ));",Right( GroupList[c], 3 ) == "ON", plotswp = plotswp || colabrv[n] ||"_Plot << (Curve[" || Char( c ) ||"] << Line Width( 3 ));")); plotswp2 = plotswp || colabrv[n] || "_Plot_r =" || colabrv[n] || "_Plot<<report;" || colabrv[n] || "_Plot_Frame = " || colabrv[n] || "_Plot_r[FrameBox (1)]; Xaxis = "|| colabrv[n] || "_Plot_r[axis box (2)]; Yaxis = " || colabrv[n] ||"_Plot_r[axis box (1)]; Xaxis << Max (Axis_Max) << Min (Axis_Min) << Inc (Axis_Step)
<< Tick Font (style (1), size (12) << Show Major Grid (1)
<< Show Minor Grid (0) << Show Minor Ticks (1); Xaxis = " || colabrv[n] || "_Plot_r[Text Edit Box(2)]
<< Set Font Size( 12 ) << Set Font Style( \!"Bold\!" ) ; Yaxis << Max ("|| colabrv[n] || "_Max) << Min (" || colabrv[n] || "_Min) << Inc (" || colabrv[n] ||"_Step)
<< Tick Font (style (1), size (12)) << Show Major Grid (1) << Show Minor Grid (0)
<< Show Minor Ticks (1); Yaxis = "|| colabrv[n] ||"_Plot_r[Text Edit Box(1)] << Set Font Size( 12 )
<< Set Font Style( \!"Bold\!" ) ; " ||colabrv[n]||"_Plot_Frame << {Frame Size( 240, 190 ), Marker Size( 1 ),
Line Width Scale( 3 )} ;"; plotswp2 = Eval( Parse( plotswp2 ) ); ); ) ); );

Here is the modified script. I can't control the font color  but what I added was this part "By(:ColumnGrp)" Everything else was the same.

CodeBlk=Expr(
	 colname = {"Column1", "Column2", "Column3"};
	 colabrv = {};
	 For (i=1, i<=Nitems(colname), i++, colabrv=Insert(colabrv,"Var"||Char(i)));
	 all_col = dtable << get column names( string );
	 If(!Contains(all_col, "Column_Grp"),
	 dtable << New Column ("Column_Grp",
Formula(If(:Tester_MD=="Tester1", "Tester1", "Other Testers"))); ); New Window("GRAPHS", Lineup Box(Ncol(2), For( n = 1, n <= Nitems(colname), n++, plotswp = "current data table(subdt);" ||
colabrv[n]||"_Max = col quantile( :Name( \!"" || colname[n] ||"\!" ), 0.5 )+(2*col Std Dev( :Name( \!"" || colname[n] ||"\!" ) ));"||
colabrv[n]||"_Min = col quantile( :Name( \!""||colname[n]||"\!" ), 0.5 )-
(2*col Std Dev( :Name( \!"" || colname[n] ||"\!" ) ));" ||
colabrv[n] || "_Step = Std Dev( :Name( \!""|| colname[n] || "\!" ) );" || "current data table(dtable);" ||
colabrv[n] ||"_Plot = Bivariate (Y( :Name( \!"" || colname[n] ||"\!" ) ),
X( :Name( \!"XColumn\!" ) ),group by (groupcol),
By(:ColumnGrp), Fit Spline(1000));"; For( c = 1, c <= GroupListN, c++,
If(Right( GroupList[c], 3 ) == "OFF",
plotswp = plotswp || colabrv[n] ||"_Plot << (Curve[" || Char( c ) ||"]
<< Line Style( Dashed ));",Right( GroupList[c], 3 ) == "ON", plotswp = plotswp || colabrv[n] ||"_Plot << (Curve[" || Char( c ) ||"] << Line Width( 3 ));")); plotswp2 = plotswp || colabrv[n] || "_Plot_r =" || colabrv[n] || "_Plot<<report;" || colabrv[n] || "_Plot_Frame = " || colabrv[n] || "_Plot_r[FrameBox (1)]; Xaxis = "|| colabrv[n] || "_Plot_r[axis box (2)]; Yaxis = " || colabrv[n] ||"_Plot_r[axis box (1)]; Xaxis << Max (Axis_Max) << Min (Axis_Min) << Inc (Axis_Step)
<< Tick Font (style (1), size (12) << Show Major Grid (1)
<< Show Minor Grid (0) << Show Minor Ticks (1); Xaxis = " || colabrv[n] || "_Plot_r[Text Edit Box(2)]
<< Set Font Size( 12 ) << Set Font Style( \!"Bold\!" ) ; Yaxis << Max ("|| colabrv[n] || "_Max) << Min (" || colabrv[n] || "_Min) << Inc (" || colabrv[n] ||"_Step)
<< Tick Font (style (1), size (12)) << Show Major Grid (1) << Show Minor Grid (0)
<< Show Minor Ticks (1); Yaxis = "|| colabrv[n] ||"_Plot_r[Text Edit Box(1)] << Set Font Size( 12 )
<< Set Font Style( \!"Bold\!" ) ; " ||colabrv[n]||"_Plot_Frame << {Frame Size( 240, 190 ), Marker Size( 1 ),
Line Width Scale( 3 )} ;"; plotswp2 = Eval( Parse( plotswp2 ) ); ); ) ); );

If I remove the FrameBox part, the script works. But I need that part to customize my graphs; I can't delete it.

CodeBlk=Expr(
	 colname = {"Column1", "Column2", "Column3"};
	 colabrv = {};
	 For (i=1, i<=Nitems(colname), i++, colabrv=Insert(colabrv,"Var"||Char(i)));
	 all_col = dtable << get column names( string );
	 If(!Contains(all_col, "Column_Grp"),
	 dtable << New Column ("Column_Grp",
Formula(If(:Tester_MD=="Tester1", "Tester1", "Other Testers"))); ); New Window("GRAPHS", Lineup Box(Ncol(2), For( n = 1, n <= Nitems(colname), n++, plotswp = "current data table(subdt);" ||
colabrv[n]||"_Max = col quantile( :Name( \!"" || colname[n] ||"\!" ), 0.5 )+(2*col Std Dev( :Name( \!"" || colname[n] ||"\!" ) ));"||
colabrv[n]||"_Min = col quantile( :Name( \!""||colname[n]||"\!" ), 0.5 )-
(2*col Std Dev( :Name( \!"" || colname[n] ||"\!" ) ));" ||
colabrv[n] || "_Step = Std Dev( :Name( \!""|| colname[n] || "\!" ) );" || "current data table(dtable);" ||
colabrv[n] ||"_Plot = Bivariate (Y( :Name( \!"" || colname[n] ||"\!" ) ),
X( :Name( \!"XColumn\!" ) ),group by (groupcol),
By(:ColumnGrp), Fit Spline(1000));"; For( c = 1, c <= GroupListN, c++,
If(Right( GroupList[c], 3 ) == "OFF",
plotswp = plotswp || colabrv[n] ||"_Plot << (Curve[" || Char( c ) ||"]
<< Line Style( Dashed ));",Right( GroupList[c], 3 ) == "ON", plotswp = plotswp || colabrv[n] ||"_Plot << (Curve[" || Char( c ) ||"] << Line Width( 3 ));")); plotswp2 = plotswp || colabrv[n] || "_Plot_r =" || colabrv[n] || "_Plot<<report;" || colabrv[n] || "_Plot_Frame = " || colabrv[n] || "_Plot_r[FrameBox (1)]; Xaxis = "|| colabrv[n] || "_Plot_r[axis box (2)]; Yaxis = " || colabrv[n] ||"_Plot_r[axis box (1)]; Xaxis << Max (Axis_Max) << Min (Axis_Min) << Inc (Axis_Step)
<< Tick Font (style (1), size (12) << Show Major Grid (1)
<< Show Minor Grid (0) << Show Minor Ticks (1); Xaxis = " || colabrv[n] || "_Plot_r[Text Edit Box(2)]
<< Set Font Size( 12 ) << Set Font Style( \!"Bold\!" ) ; Yaxis << Max ("|| colabrv[n] || "_Max) << Min (" || colabrv[n] || "_Min) << Inc (" || colabrv[n] ||"_Step)
<< Tick Font (style (1), size (12)) << Show Major Grid (1) << Show Minor Grid (0)
<< Show Minor Ticks (1); Yaxis = "|| colabrv[n] ||"_Plot_r[Text Edit Box(1)] << Set Font Size( 12 )
<< Set Font Style( \!"Bold\!" ) ; " ||colabrv[n]||"_Plot_Frame << {Frame Size( 240, 190 ), Marker Size( 1 ),
Line Width Scale( 3 )} ;"; plotswp = Eval( Parse( plotswp ) ); ); ) ); );

I checked in the FrameBox index is altered but it is still the same.

Any ideas on how do debug this?

Thanks.

 

 

1 REPLY 1
Highlighted
ih
ih
Level VII

Re: FrameBox Error Occurs when By Function is added in Bivariate Plot Script

Can you share some example data so we can try running your script?

Article Labels

    There are no labels assigned to this post.