From octave-maintainers-request at bevo dot che dot wisc dot edu Wed Jan 28 21:23:49 2004 Subject: Re: contour plots and doing graphics in octave From: Donald J Bindner To: octave-maintainers at bevo dot che dot wisc dot edu Date: Wed, 28 Jan 2004 21:18:37 -0600 On Wed, Jan 28, 2004 at 09:51:03PM -0500, Paul Kienzle wrote: > Ideally you should create a routine which returns the lines you > want to draw, and leave it to another routine to do the > plotting. That allows flexibility in choosing a plotting > package. > > If you need to do the plotting from C++, I would > recommend using feval to call the usual plot scripts > rather trying to tie directly into the stream. Something like: > > #include > ... > octave_value_list in; > in(2) = "x;my line;"; > in(1) = Y; > in(0) = X; > feval("plot",in,0); // nargout==0 I can think about that. It adds substantial complication to "follow" the contour lines around the grid, and there's no guarantee that contour lines have to be simple, connected, non-self-intersecting curves with an obvious starting and ending point. The beauty of my current method is that it doesn't require a traversal method; you just look at each rectangle of the grid and draw the parts of contour lines that itersect that rectangle. I don't think I could pass 5000 separate line segments to the plot routine very effectively. Writing the data in gnuplot format does tie the routine to that program, but not really more than the current contour.m in Octave. So it's not really ideal, but it isn't really a step backward either. Your post does make me understand how I can use feval( "graw" ) to send the actual drawing commands. There still seems to be one small problem. I notice that if you send a gnuplot "pl" (plot) command with graw, it doesn't modify plot_line_count because you aren't working within the regular plot system. That means that unless some other plot has already been done using the usual methods, I can't continue the drawing (with regular commands), even if I set the hold state on. You can hack around that by drawing a junk plot first, but it obviously isn't the right thing to do. -- Don Bindner