[prev in list] [next in list] [prev in thread] [next in thread]
List: gnuplot-info-beta
Subject: [PATCH 2/2] String variables (from datafile column)
From: Ethan Merritt <merritt () u ! washington ! edu>
Date: 2002-08-16 4:55:14
[Download RAW message or body]
Hi all.
String variables in gnuplot: Patch 2 of 2
I have uploaded to SourceForge a pair of patches that implement two
aspects of handling string variables in gnuplot. Neither patch is
intended to go right into CVS. These are proof-of-principle demos
of how string variables might work. They are both usable, however,
so I welcome feedback/suggestions/criticism from multiple testers.
Patch 2
-------
The second patch implements a different take on string variables.
It allows you to read in string values from selected columns of
a data file. This is basic support that could be used for many
new plotting capabilities. I have implemented only one simple
command by way of example:
Given a datafile containing something like:
# Label X-position Y-position
#
Origin 0 0
A .1 .2
B .2 .1
HiThere .14 .3
Then
plot 'datafile' using 2:3:1 with labels
will place centered labels "Origin" "A" "B" "HiThere" at
the (x,y) coordinates specified.
'plot ... with labels' requires 3 columns of input: x, y, string
Notes
-----
- Patch 1 added ./configure --enable-stringvariables
Patch 2 can be applied independently from patch 1, but if you
haven't previously applied patch 1 then you will have to
manually add a line to ./config.h before running "make"
#define GP_STRING_VARS 1
- The underlying implementation touches enough bits of code that
I may have overlooked side-effects. As I said, this is not
intended to go straight into CVS; it's a proof-of-principle
patch for people to play with. But it does work :-)
- I think this support may be powerful enough so that some brave
soul could re-implement time/date input in a much simpler manner.
It's always nice when a new feature actually allows you to
remove or simplify old code.
- The sample 'plot ... with labels' implementation is pretty minimal.
It should logically accept many of the normal label suboptions
plot ... with labels
{<justification>} {norotate | rotate {by <degrees>}}
{"font,size"} {textcolor <colorspec>}
This should be fairly easy, actually, because what I did was to
trivially modify the existing routine place_labels( level ) to be
place_labels( listhead, level ). This allows you to pass an
arbitrary list of text_label structures to it for processing,
which is exactly what I did.
--
Ethan A Merritt merritt@u.washington.edu
Biomolecular Structure Center Box 357742
University of Washington, Seattle, WA 98195
phone: (206)543-1421
FAX: (206)685-7002
[[[[ unsubscribe from info-gnuplot-beta via majordomo@dartmouth.edu ]]]]
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic