How to handle missing values

I'm adding a moving average to a finance chart. I currently am doing the

    ma20 = movavg_function(open_price_bars, 20)
    axMiddle.plot(vind, ma5, 'b', linewidth=1)

The problem is that because there are missing data elelments for the
underlying time series data the moving average for some days is also missing
values. I have a special moving average function which allows for gaps (or
missing) values.

Is there any way (by modifying) plot that if axMiddle.plot comes across a
missing value (in my case market by -1, but could be anythin) then it does
not plot that particular data point.

One solution would obviously be to scan the moving average and construct a
new index list for all points which have valid data. Is there another option
by modifying the underlying axes.plot function?