numpy masked array plot - isolated single unmasked value is hidden

Hi,

The following example demonstrates the problem, value 5 could not be
seen w/o marker:

data = np.arange(10)
mask = [0,0,0,1,1,0,1,0,0,0]
x = np.ma.masked_array(data, mask)
plot(x)
plot(x, '+')

In my datasets, isolated unmasked values are rare, but placing a
marker to spot them makes the whole graph cluttered. I do realize that
at least 2 valid points are needed for a line segment, but still, is
there any way to visualize these isolated unmasked values w/o a
marker?

Thanks,
Gregorio

You could use a single pixel for a marker (','), I guess. But as you say, you need at least two points for a line segment.

Mike

···

On 07/17/2013 10:45 AM, Gregorio Bastardo wrote:

Hi,

The following example demonstrates the problem, value 5 could not be
seen w/o marker:

data = np.arange(10)
mask = [0,0,0,1,1,0,1,0,0,0]
x = np.ma.masked_array(data, mask)
plot(x)
plot(x, '+')

In my datasets, isolated unmasked values are rare, but placing a
marker to spot them makes the whole graph cluttered. I do realize that
at least 2 valid points are needed for a line segment, but still, is
there any way to visualize these isolated unmasked values w/o a
marker?

Thanks,
Gregorio

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Thanks Mike, it's hard to spot, but still better than nothing. Anyway,
could it be the default behaviour of plotting masked arrays (single
pixel for an isolated element)?

2013/7/17 Michael Droettboom <mdroe@...86...>:

···

You could use a single pixel for a marker (','), I guess. But as you
say, you need at least two points for a line segment.

Mike

On 07/17/2013 10:45 AM, Gregorio Bastardo wrote:

Hi,

The following example demonstrates the problem, value 5 could not be
seen w/o marker:

data = np.arange(10)
mask = [0,0,0,1,1,0,1,0,0,0]
x = np.ma.masked_array(data, mask)
plot(x)
plot(x, '+')

In my datasets, isolated unmasked values are rare, but placing a
marker to spot them makes the whole graph cluttered. I do realize that
at least 2 valid points are needed for a line segment, but still, is
there any way to visualize these isolated unmasked values w/o a
marker?

Thanks,
Gregorio

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Thanks Mike, it's hard to spot, but still better than nothing. Anyway,
could it be the default behaviour of plotting masked arrays (single
pixel for an isolated element)?

Gregorio,

I don't think this would be a good idea. It adds quite a bit of complexity for a special case--and inevitably, the next request from someone would be to have the option of using any marker for the isolated points. The concept of "single pixel" gets slippery across backends and output devices.

A better solution would be a simple function to identify such isolated points, for use when needed, to plot such points however you choose, typically with a separate call to "plot" specifying a marker. This way, the extra complexity is called explicitly when needed, not carried along by every call to "plot".

Eric

···

On 2013/07/17 11:25 PM, Gregorio Bastardo wrote:

2013/7/17 Michael Droettboom <mdroe@...86...>:

You could use a single pixel for a marker (','), I guess. But as you
say, you need at least two points for a line segment.

Mike

On 07/17/2013 10:45 AM, Gregorio Bastardo wrote:

Hi,

The following example demonstrates the problem, value 5 could not be
seen w/o marker:

data = np.arange(10)
mask = [0,0,0,1,1,0,1,0,0,0]
x = np.ma.masked_array(data, mask)
plot(x)
plot(x, '+')

In my datasets, isolated unmasked values are rare, but placing a
marker to spot them makes the whole graph cluttered. I do realize that
at least 2 valid points are needed for a line segment, but still, is
there any way to visualize these isolated unmasked values w/o a
marker?

Thanks,
Gregorio

Or make a stairstep, if each time has a finite duration. like the following (though I am sure there are some inelegant code in there.

data = np.arange(10)
mask = [0,0,0,1,1,0,1,0,0,0]
x = np.ma.masked_array(data, mask)
t = arange(-0.5,shape(x)[0]-0.5,1.)

xx=ma.zeros((2,10))
xx[0,:]=x
xx[1,:]=x
tt=0.*xx
tt[0,:]=t
tt[1,:]=t+0.9999999
tt=reshape(tt,(20),order='F')
xx=reshape(xx,(20),order='F')
plot(tt,xx)

···

On Jul 17, 2013, at 7:45 AM, Gregorio Bastardo <gregorio.bastardo@...1896....> wrote:

Hi,

The following example demonstrates the problem, value 5 could not be
seen w/o marker:

data = np.arange(10)
mask = [0,0,0,1,1,0,1,0,0,0]
x = np.ma.masked_array(data, mask)
plot(x)
plot(x, '+')

In my datasets, isolated unmasked values are rare, but placing a
marker to spot them makes the whole graph cluttered. I do realize that
at least 2 valid points are needed for a line segment, but still, is
there any way to visualize these isolated unmasked values w/o a
marker?

Thanks,
Gregorio

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Jody Klymak
http://web.uvic.ca/~jklymak/

@Eric: thanks, i see the point

@Jody: thanks for the trick, I'll first try Eric's approach

2013/7/18 Eric Firing <efiring@...202...>:

···

On 2013/07/17 11:25 PM, Gregorio Bastardo wrote:

Thanks Mike, it's hard to spot, but still better than nothing. Anyway,
could it be the default behaviour of plotting masked arrays (single
pixel for an isolated element)?

Gregorio,

I don't think this would be a good idea. It adds quite a bit of
complexity for a special case--and inevitably, the next request from
someone would be to have the option of using any marker for the isolated
points. The concept of "single pixel" gets slippery across backends and
output devices.

A better solution would be a simple function to identify such isolated
points, for use when needed, to plot such points however you choose,
typically with a separate call to "plot" specifying a marker. This way,
the extra complexity is called explicitly when needed, not carried along
by every call to "plot".

Eric

2013/7/17 Michael Droettboom <mdroe@...86...>:

You could use a single pixel for a marker (','), I guess. But as you
say, you need at least two points for a line segment.

Mike

On 07/17/2013 10:45 AM, Gregorio Bastardo wrote:

Hi,

The following example demonstrates the problem, value 5 could not be
seen w/o marker:

data = np.arange(10)
mask = [0,0,0,1,1,0,1,0,0,0]
x = np.ma.masked_array(data, mask)
plot(x)
plot(x, '+')

In my datasets, isolated unmasked values are rare, but placing a
marker to spot them makes the whole graph cluttered. I do realize that
at least 2 valid points are needed for a line segment, but still, is
there any way to visualize these isolated unmasked values w/o a
marker?

Thanks,
Gregorio

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users