Bring Drag & Drop to Dash with Dashboard Engine. 💫 Learn how at our next webinar!

Mask singularity like matplotlib

I use Dash for graphing various functions, like 1 / x, etc, that have a singularity (1 / 0) is undefined. However, Dash insists on connecting the dots on either side of 0.
matplotlib allows masking out around a singularity.
For example, if a singularity is at 2 … snippet

step = 0.01
xx = np.arange(-0.5, 5.5, step)
singularity_x = 2
xx = np.ma.masked_inside(xx, singularity_x - step, singularity_x + step)

I could elaborate, however, I’ll float this basic question for now about masking in Dash Python.

You might be able to insert a None value in your array and set connectgaps=False

See

Thanks, None value with connectgaps=False works fine.

1 Like