|
From: Ethan M. <merritt@u.washington.edu> - 2007-12-04 19:21:28
|
On Tuesday 04 December 2007 02:09, Shigeharu TAKENO wrote: > 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): Yes, this is a good idea. But there is a small problem with your patch. By default it takes the title from the 2nd column of the data file. This is correct for a 2D plot, but for a 3D plot it should take the title from the 3rd column. Test case: set key autotitle columnheader plot 'foo.dat' using 1:2 # title comes from column 2 (correct) splot 'foo.dat' using 1:2:3 # title comes from column 2 (error) Could you fix that, and upload the patch to SourceForge? thanks Ethan Merritt <sf...@us...> > ----- 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 > +========================================================+ > > ------------------------------------------------------------------------- > SF.Net email is sponsored by: The Future of Linux Business White Paper > from Novell. From the desktop to the data center, Linux is going > mainstream. Let it simplify your IT future. > http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 > _______________________________________________ > gnuplot-beta mailing list > gnu...@li... > https://lists.sourceforge.net/lists/listinfo/gnuplot-beta > |