|
From: Daniel J S. <dan...@ie...> - 2005-01-27 21:19:29
|
Ethan Merritt wrote: >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. > > I would too. However, might it be possible to use some simple algorithm that does an OK job in most cases? The worst case scenario is when the contours are rather small oval shapes, or rather close together. But if it is unacceptable to the user, then he or she could turn off annotation. Rather than an optimization problem where we, say, pick a trajectory with the smallest gradient (i.e., largest spacing between contours), could we just pick some line for which to intersect as the spot to pick the label text? (Intersecting with lines is a not so difficult thing.) The contour plot algorithm apparently already knows how to create the contours and whether they are lines or closed curves. So, if it is a closed curve, pick the starting point or some other rule. If it is an open curve, take the line that bisects the endpoints and find where that intersects the curve. I can already imagine what you meant, Hans, (the tangled web I weave) but when the strange level curves happen, the annotation could be disabled by the user. >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: > > OK, so Ethan has already given a Bessel function example where the contours get a bit wacky. But because of the crowded closed curves in the x=1.5 to 2.5 band, this would probably be one where the user asks to not annotate the contours. Otherwise the plot would be riddled with text. Ethan's mouse idea could work, but I think once one does that, people will start asking for more and more mouse features to the point where gnuplot becomes GUI oriented. Which might be OK. So the routine would do some type of interpolation and figure out what the value of the level curve nearby should be? (Not saying you should do this, but just wondering what you have in mind.) Perhaps not the easiest thing either, Ethan, once those level curves get close together. You are relying on the user to properly point to the curve of interest of which there may be a few nearby. Dan |