|
From: Shigeharu T. <sh...@ie...> - 2007-12-04 10:09:46
|
shige 12/04 2007 ---------------- The command 'plot' can read the plot title in the key box from a datafile by by "title column(N)" or "title N" in 2D (plot), but 'splot' cannot. I think 'splot' can read by the following patch (for CVS version of gnuplot): ----- From here ----- diff -uN gnuplot-current/src/datafile.c.ORG gnuplot-current/src/datafile.c --- gnuplot-current/src/datafile.c.ORG Tue Dec 4 18:46:31 2007 +++ gnuplot-current/src/datafile.c Tue Dec 4 18:48:06 2007 @@ -2727,6 +2727,22 @@ plot->title_no_enhanced = !keyT.enhanced; } +/* shige */ +void +df_set_key_title3(struct surface_points *plot) +{ + /* What if there was already a title specified? */ + if (plot->title && !plot->title_is_filename) + return; + if (plot->title_is_suppressed) + return; + if (plot->title) + free(plot->title); + + plot->title = gp_strdup(df_key_title); + plot->title_no_enhanced = !keyT.enhanced; +} + static void df_parse_string_field(char *string, char *field) { diff -uN gnuplot-current/src/datafile.h.ORG gnuplot-current/src/datafile.h --- gnuplot-current/src/datafile.h.ORG Tue Dec 4 18:46:31 2007 +++ gnuplot-current/src/datafile.h Tue Dec 4 18:47:13 2007 @@ -117,6 +117,8 @@ int df_3dmatrix __PROTO((struct surface_points *, int)); #ifdef EAM_DATASTRINGS void df_set_key_title __PROTO((struct curve_points *)); +/* shige */ +void df_set_key_title3 __PROTO((struct surface_points *)); int expect_string __PROTO((const char column )); #endif diff -uN gnuplot-current/src/plot3d.c.ORG gnuplot-current/src/plot3d.c --- gnuplot-current/src/plot3d.c.ORG Tue Dec 4 18:46:32 2007 +++ gnuplot-current/src/plot3d.c Tue Dec 4 18:48:39 2007 @@ -746,6 +746,19 @@ } continue; } +/* shige */ +#ifdef EAM_DATASTRINGS + else if (j == DF_FOUND_KEY_TITLE){ + df_set_key_title3(this_plot); + continue; + } + else if (j == DF_KEY_TITLE_MISSING){ + fprintf(stderr, + "get_data: key title not found in requested column\n" + ); + continue; + } +#endif /* its a data point or undefined */ if (xdatum >= local_this_iso->p_max) { @@ -1495,6 +1508,8 @@ int_error(c_token, "duplicated or contradicting arguments in plot options"); /* set default values for title if this has not been specified */ + /* shige */ + this_plot->title_is_filename = FALSE; if (!set_title) { this_plot->title_no_enhanced = TRUE; /* filename or function cannot be enhanced */ if (key->auto_titles == FILENAME_KEYTITLES) { @@ -1515,6 +1530,8 @@ xtitle = this_plot->title; else if (crnt_param == 1) ytitle = this_plot->title; + /* shige */ + this_plot->title_is_filename = TRUE; } else { if (xtitle != NULL) xtitle[0] = '\0'; ----- To here ----- +========================================================+ Shigeharu TAKENO NIigata Institute of Technology kashiwazaki,Niigata 945-1195 JAPAN sh...@ie... TEL(&FAX): +81-257-22-8161 +========================================================+ |