From: FRUITS on
On Jun 2, 4:25 am, Walter Roberson <rober...(a)hushmail.com> wrote:
> FRUITS wrote:
> > This is exactly what I want to do.  I want to give any negative values
> > that happen to occur in the region  0 <= x <= 25 a specific color
> > (say,green), (as long as the negative points are in the region, it
> > does not matter how many negative points I have - i.e the length),
> > and the ones in the region 25 <= x <= 50 another color and 0 <= x <=
> > 50 (ie. the whole x domain) another color.
>
> > If I dont have any negative values in any region I also want to give
> > it another color...so, in total I need to assign 4 different colors to
> > 4 different cases.
>
> We are getting closer, but I do not understand the bit about the whole x
> domain. You appear to be saying that when 0 <= x < 25, that you want to
> color the point both the first color _and_ the third color, since 0 <= x
> < 25 is also part of the range 0 <= x <= 50; likewise, 25 < x <= 50
> should be colored both the second and third color, and 25 exactly, which
> falls under all three conditions, should be all three colors simultaneous..


Let me say that again. I loop through my "other program" using
params1 and params2.
If D is ALWAYS negative in the region from x=0 to x=50 (and say 50 is
the end of the spatial domain)
then I would give it a specific color.

If D is negative ONLY from x=0 to x=25 then I give it another color.

If D is negative ONLY from x=25 to x=50 then I give it another color.

If D is non-negative anywhere then I give it another color.

I just want to know how to color these regions using pcolor.
Please let me know if you need any clarifications.







From: Walter Roberson on
FRUITS wrote:

> Let me say that again. I loop through my "other program" using
> params1 and params2.
> If D is ALWAYS negative in the region from x=0 to x=50 (and say 50 is
> the end of the spatial domain)
> then I would give it a specific color.
>
> If D is negative ONLY from x=0 to x=25 then I give it another color.
>
> If D is negative ONLY from x=25 to x=50 then I give it another color.
>
> If D is non-negative anywhere then I give it another color.

Is it the case that at each step, x is a vector of values, each in the
range 0 to 50 and that D is the same length as x, with each element of D
corresponding to the x in the same position? If so, then is x always a
full vector from 0 to 50, or does it sometimes cover only part of that
range? Is 25 certain to be at the mid-point of the vector of x? Is x
sorted in ascending order?

If x _is_ a vector of values ranging from 0 to 50, and if you want the
colors to be determined point-wise, then please clarify which color you
would want for the following cases:

- No D are negative

- some but not all D corresponding to 0 to 25 are negative, and no D
corresponding to 25 to 50 are negative

- all D corresponding to 0 to 25 are negative, and no D corresponding to
25 to 50 are negative

- no D corresponding to 0 to 25 are negative, and some but not all D
corresponding to 25 to 50 are negative

- some but not all D corresponding to 0 to 25 are negative, and some but
not all D corresponding to 25 to 50 are negative

- all D corresponding to 0 to 25 are negative, and some but not all D
corresponding to 25 to 50 are negative

- no D corresponding to 0 to 25 are negative, and all D corresponding to
25 to 50 are negative

- some but not all D corresponding to 0 to 25 are negative, and all D
corresponding to 25 to 50 are negative

That is 8 possible cases -- more if you wish to detect D equal to 0.


Please also decide (arbitrarily if necessary) which of the two sides you
want x exactly equal to 25 to fall into. It is computationally more
efficient if you have x exactly equal to 25 fall into the first half.


The alternative to all of this is that x is, after each run, a single
value that is in the range 0 to 50, and that you are asking that the
entire graph be colored one color if all of the D are negative at every
iteration, and that each location which ended up with an x from 0 to 25
be colored with a second color if all of the D are negative at those
locations, and that each location which ended up with an x from 25 to 50
be colored with a third color if all of the D are negative at those
locations. This leaves open the question of what colors you would wish
to use if somewhere in the graph, there was a location in which at least
one D was non-negative, and so on.