Mercurial > hg > octave-lyh
changeset 2543:050924aee81a
[project @ 1996-11-20 03:03:01 by jwe]
author | jwe |
---|---|
date | Wed, 20 Nov 1996 03:03:02 +0000 |
parents | 484977eb65ad |
children | a33bbd3fadd7 |
files | src/ChangeLog src/pt-plot.cc src/pt-plot.h |
diffstat | 3 files changed, 33 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,8 +1,9 @@ Tue Nov 19 12:01:13 1996 John W. Eaton <jwe@bevo.che.wisc.edu> * lex.l (plot_style_token): Add new plot styles for gnuplot 3.6. - * pt-plot.cc (subplot_style::errorbars): Recognize more errorbar - plot types. + * pt-plot.cc (subplot_style::columns_ok): Rename from + subplot_style::errorbars. Recognize more styles and do a better + job of diagnosing column number/style mismatches. * sighandlers.cc (my_friendly_exit): If we are called twice, try to remove the signal handler for SIGABRT and the call abort ().
--- a/src/pt-plot.cc +++ b/src/pt-plot.cc @@ -599,15 +599,33 @@ return 0; } -int -subplot_style::errorbars (void) +bool +subplot_style::columns_ok (int nc) { - return (almost_match ("boxerrorbars", sp_style, 5, 0) - || almost_match ("boxxyerrorbars", sp_style, 4, 0) - || almost_match ("errorbars", sp_style, 1, 0) - || almost_match ("xerrorbars", sp_style, 2, 0) - || almost_match ("xyerrorbars", sp_style, 2, 0) - || almost_match ("yerrorbars", sp_style, 1, 0)); + bool retval = true; + + if ((almost_match ("boxes", sp_style, 5, 0) && nc != 3) + || (almost_match ("boxerrorbars", sp_style, 5, 0) + && (! (nc == 3 || nc == 4 || nc == 5))) + || ((almost_match ("boxxyerrorbars", sp_style, 4, 0) + || almost_match ("xyerrorbars", sp_style, 2, 0)) + && (! (nc == 4 || nc == 6 || nc == 7))) + || ((almost_match ("candlesticks", sp_style, 1, 0) + || almost_match ("financebars", sp_style, 2, 0)) + && nc != 5) + || ((almost_match ("errorbars", sp_style, 1, 0) + || almost_match ("xerrorbars", sp_style, 1, 0) + || almost_match ("yerrorbars", sp_style, 1, 0)) + && (! (nc == 3 || nc == 4)))) + { + error + ("invalid number of data columns = %d specified for plot style `%s'", + nc, sp_style.c_str ()); + + retval = false; + } + + return retval; } void @@ -647,17 +665,10 @@ retval = data; } - if (ndim == 2 && sp_style_clause && sp_style_clause->errorbars ()) - { - int nc = retval.columns (); + int nc = retval.columns (); - if (nc < 3 || nc > 6) - { - error ("plots with errorbars require 3 to 6 columns of data"); - error ("but %d were provided", nc); - return octave_value (); - } - } + if (ndim == 2 && sp_style_clause && ! sp_style_clause->columns_ok (nc)) + return octave_value (); return retval; }