|
From: Ethan M. <merritt@u.washington.edu> - 2005-01-25 17:06:47
|
On Tuesday 25 January 2005 05:04 am, Hans-Bernhard Broeker wrote:
> Daniel J Sebald wrote:
>
> > Also, I just want to confirm that gnuplot contours can't do the
> > following type of labelling?
X
> >
> > ------ 20 ------
> >
> > ------------ 30 --------
>
Y
> Right, it can't. The main problem being that it's an absolute beast of
> a problem to figure out *where* to put such labels
I agree that it is difficult.
On the other hand, the mousing code is now versatile enough
that you could write a script to add the labels interactively.
I can imagine a semi-automated mode in which you click twice,
once at point X above and once and point Y above, and the script
proceeds to add a label on each intervening contour.
The demo below was written for a different purpose, but it
illustrates some of the same ideas:
# Contour-slice demo
# Ethan A Merritt <merritt@u.washington.edu>
#
set samples 40, 40
set isosamples 41, 41
set contour base
set cntrparam levels auto 10
set title "Interactive contour slicing demo"
f(x,y) = sin(x) * cos(y)
f(x,y) = sin(13*besj0(x)) * cos(y/ (0.1 + (abs(x-2.))) )
# Plot function with contours
set view map
unset surface
splot [x=-0:4] [y=0:2] f(x,y)
pause mouse "Click on some point\n"
x0 = MOUSE_X
y0 = MOUSE_Y
pause mouse "Click on another point\n"
x1 = MOUSE_X
y1 = MOUSE_Y
# Show selected path
set arrow 1 from x0,y0 to x1,y1
replot
pause -1 "Hit return to plot contours along this slice"
unset arrow 1
# Define parametric function running along this line
g(z) = f( x0 + z*(x1-x0), y0 + z*(y1-y0) )
# Plot the value of f(x) along the selected path
set xlabel "Fractional distance along selected path"
set samples 500
unset key
set label 1 sprintf("(%.3f,%.3f)",x0,y0) at 0,g(0) tc lt 3
set label 2 sprintf("(%.3f,%.3f)",x1,y1) at 1,g(1) right tc lt 3
plot [x=0:1] g(x)
pause -1
--
Ethan A Merritt merritt@u.washington.edu
Biomolecular Structure Center
Mailstop 357742
University of Washington, Seattle, WA 98195
|