From: Ethan M. <merritt@u.washington.edu> - 2004-04-30 20:12:59
|
I'm switching this to the mailing list because it's much more convenient for discussion than using the SourceForge interface. On Friday 30 April 2004 10:52 am, Petr Milulik wrote: > > > 'set style function filledcurve'. > > No, this I would not support, currently you cannot use > "using" for functions. > However, > 'a.dat' using 1:2:(sin($1)) > would work. But currently you can do plot sin(x) with filledcurve y1=0.5 The existing patch extends this to plot sin(x) with filledcurve below y1=0.5 I had in mind a further extension to allow both plot sin(x) with filledcurve below y1=f(x) plot 'data' using 1:2 with filledcurve above y1=f(x) But your suggestion above is a better idea, at least for the data case, because it uses existing function evaluation code: plot 'data' using 1:2:(f($1)) with filledcurve That leaves a few questions: Do we allow "above" and "below" in this case? I think it reasonable that plot 'data' using 1:2:(f($1)) with filledcurve above would fill only those areas where $2 > f($1) What exactly should be filled if f(x) is undefined at a given x? Or in the case of two datasets, what if one of the datasets has a missing value? > > By contrast, drawing a filled region bounded by two > > arbitrary curves requires storing twice as much information > > for the plot. > > I don't think that's difficult. I agree. I said it would be fairly easy. My only reservation was that it requires code changes in more places than the simpler case of a bounding line. Ethan > At graphics.c:1832: > for (i = 0; i < plot->p_count; i++) { > there is > x = map_x(plot->points[i].x); > y = map_y(plot->points[i].y); > so plotting wrt 3 columns would have > y2 = map_y(plot->points[i].z); > ...I think that parser for plotting wrt 3 columns puts the > 3rd column number into z. > > Then the INRANGE/OUTRANGE cases would have to go in between > crossing points in between those 2 curves using max(y,y2), > and make a circle -- i.e., instead of finish_filled_curve(), > it should do the 2nd round back using values min(y,y2). > > > ---------------------------------------------------------------------- > > Comment By: Ethan Merritt (sfeam) > Date: 2004-04-30 16:06 > > Message: > Logged In: YES > user_id=235620 > > Petr wrote> > > > I would propose to submit it to cvs, as it is a valuable > > feature for the curretion version of gnuplot. > > Hold off a bit. Steve claims to have found a case where my > patch gets the sidedness wrong, although so far I have not > been able to reproduce the problem. We're pursuing the > discrepancy in private Email. > > >Another great enhancement would be > > plot 'a.dat' using 1:2:3 with filledcurve > >where the filled area would be in between > > y-points of columns 2 and 3. > > The ability to fill an area between two curves has been > requested a number of times before. I thought there was an > existing RFE here on SourceForge, but I can't see it now. > Anyhow, this would be a much more extensive change than the > simple bounding-line patch I gave here. The code to draw > filled polygons bounded by a line was already present. All > I had to do was make sure that any line segment crossing the > bounding line is broken into two pieces so that no single > polygon ever spans both sides of the boundary. > > By contrast, drawing a filled region bounded by two > arbitrary curves requires storing twice as much information > for the plot. As you show, it requires an additional input > column. Or, I suppose, two bounding equations in the case of > 'set style function filledcurve'. This means that it is > effectively a new plot style, and would require adding new > code in a lot of places. I think this would be fairly easy, > but still it would be a bigger project than my simple patch > here. Certainly it goes way beyond what could be considered > a bug-fix for version 4.0 > > So yeah, I agree it would be a very nice, fairly > straightforward addition. But it can wait until the next > round of development. > > ---------------------------------------------------------------------- > > Comment By: Petr Mikulik (mikulik) > Date: 2004-04-30 10:00 > > Message: > Logged In: YES > user_id=31505 > > I like this patch! > > I would propose to submit it to cvs, as it is a valuable > feature for the curretion version of gnuplot. > > Another great enhancement would be > plot 'a.dat' using 1:2:3 with filledcurve > where the filled area would be in between y-points of > columns 2 and 3. > Could you please try to implement this as well? > > > ---------------------------------------------------------------------- > > Comment By: Ethan Merritt (sfeam) > Date: 2004-04-29 22:00 > > Message: > Logged In: YES > user_id=235620 > > Heh. A minor, but dramatic, oversight on my part. Here's a > revised patchset that might actually work. > > ---------------------------------------------------------------------- > > Comment By: Steve Weiss (sweiss_1966) > Date: 2004-04-29 15:11 > > Message: > Logged In: YES > user_id=939458 > > It's different, but not correct. it looks like you figuring out > the bounding area to fill, you draw a line from the current > point to the previous data point as opposed to the current > point to the previous point where the x-axis was crossed (if > that makes sense). > > I have attached a sample image for you to look at. Please let > me know if you need a copy of my test script. > > Thanks for all the help! > Steve > > ---------------------------------------------------------------------- > > Comment By: Ethan Merritt (sfeam) > Date: 2004-04-29 06:26 > > Message: > Logged In: YES > user_id=235620 > > Give this patchset a try. It adds new modifiers "above" and > "below" to the filledcurve style. They apply only to the > case of explicit bounds. For example: > plot 'data' with filledcurve above y1=3.4 > > I have not done much testing of this code. Please check > whether it does what you want, and if so give it a thorough > workout. In particular I did not do anything special for > curves that go out of range. It may just work, or it may > need special-case code added. > > ---------------------------------------------------------------------- > > Comment By: Petr Mikulik (mikulik) > Date: 2004-04-08 09:56 > > Message: > Logged In: YES > user_id=31505 > > Make your graph by plotting the same curve twice, and > probably with this trick: > > plot (f(x)>g(x) ? f(x) : 1/0) > > > ---------------------------------------------------------------------- > > You can respond by visiting: > https://sourceforge.net/tracker/?func=detail&atid=352055&aid=927249&grou >p_id=2055 -- Ethan A Merritt merritt@u.washington.edu Biomolecular Structure Center Mailstop 357742 University of Washington, Seattle, WA 98195 |