octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [unclassified] Bug with patch


From: Kai Habel
Subject: Re: [unclassified] Bug with patch
Date: Tue, 09 Oct 2007 08:08:32 +0000
User-agent: IceDove 1.5.0.12 (X11/20070607)

David Bateman schrieb:
There is an issue with the patch command.. Firstly it should accept a
handle as the first argument (consider the attached patch). However the
more important issue is that it miss treats the case where more that a
single patch is treated in one call to patch. Consider the code

t = (1/16:1/8:1)'*2*pi;t2 = ((1/16:1/8:1)' + 1/32)*2*pi; x =sin(t); y =
cos(t); x2 = sin(t2); y2=cos(t2); h = patch([x,x2],[y,y2],'r')

The patches are drawn correctly, however the handle h that is returned
is a handle to the last patch drawn and not a handle to a multi-element
patch that includes all of the patches..

Its easy enough to treat the data and get this part right. However,
looking at the facecolor code I'm not sure what this was originally
trying to achieve and so I don't see the fix for this immediately.
Shai/Kai do you a what the facecolor code is trying to do and a way to
fix it to accept the cdata for multiple facets at once correctly?

D.
When writing my original code I had only single patches in mind. So, I have not looked into matlab behavior for different color arguments (single float, [rgb], 'color string') using your or a similar example.

But a quick check shows for a color string and rgb arguments only single values are allowed:

h = patch([x,x2],[y,y2],'r')

In that case 'facecolor' contains the rgb value and CData is empty.

For float values you can specify:

h = patch([x,x2],[y,y2],[10 20])

Here 'CData' contains the [10 20] vector, 'FaceColor' is set to 'flat', and 'Clim' is adapted to [10 20] accordingly. In this example those values are new max/min values for CData.
I hope this help, but I wont be able to provide a patch for this quickly (this 
week).

Kai




reply via email to

[Prev in Thread] Current Thread [Next in Thread]