qcodes/plots/qcmatplotlib.py
def _make_args_for_pcolormesh(args_masked, x, y):
        """
        Make args for pcolormesh.
        pcolormesh accepts as args either
        C - a (potentially) masked array
        or
        x, y, C where x and y are the colour box edge arrays and
        are NOT allowed to be masked
        """

        if x is not None and y is not None:
            # If x and y are provided, modify the arrays such that they
            # correspond to grid corners instead of grid centers.
            # This is to ensure that pcolormesh centers correctly and
            # does not ignore edge points.
            args = []
            for k, arr in enumerate(args_masked[:-1]):
                # If a two-dimensional array is provided, only consider the
                # first row/column, depending on the axis
                if arr.ndim > 1:
                    arr = arr[0] if k == 0 else arr[:, 0]
                # first extrapolate to fill any empty values Matplotlib 2.2 no
                # longer support nans in x and y for pcolormesh.
                if np.ma.is_masked(arr[1]):
                    step_size = 1.
                    # Only the first element is not nan. We have to guess the
                    # step size
                else:
                    # the average stepsize is our best guess
                    step_size = np.ma.average(np.ma.diff(arr))

                last_good_value = arr[np.logical_not(arr.mask)][-1]
                extrapolation_start = last_good_value+step_size
                n_invalid = np.sum(arr.mask)
                extrapolation_stop = extrapolation_start+step_size*(n_invalid-1)
                # numpy (1.14) has a deprecation warning related to shared
                # masks. Let's silence this by making sure that this is
                # not shared before modifying the mask
                arr.unshare_mask()
                arr[arr.mask] = np.linspace(extrapolation_start,
                                            extrapolation_stop,
                                            num=n_invalid)
                # Now shift array to get edge coordinates rather than
                # centre coordinates
                arr_shift = np.insert(arr, 0, arr[0])
                arr_shift[0] -= step_size/2
                arr_shift[1:] += step_size/2
                args.append(arr_shift)
            args.append(args_masked[-1])
        else:
            # Only the masked value of z is used as a mask
            args = args_masked[-1:]

        return args

        Make args for pcolormesh.
        pcolormesh accepts as args either
        C - a (potentially) masked array
        or
        x, y, C where x and y are the colour box edge arrays and
        are NOT allowed to be masked
        
Make args for pcolormesh.
pcolormesh accepts as args either
C - a (potentially) masked array
or
x, y, C where x and y are the colour box edge arrays and
are NOT allowed to be masked
Make args for pcolormesh . pcolormesh accepts as args either C - a ( potentially ) masked array or x y C where x and y are the colour box edge arrays and are NOT allowed to be masked
def _make_args_for_pcolormesh(args_masked, x, y):
        if x is not None and y is not None:
            args = []
            for k, arr in enumerate(args_masked[:-1]):
                if arr.ndim > 1:
                    arr = arr[0] if k == 0 else arr[:, 0]
                if np.ma.is_masked(arr[1]):
                    step_size = 1.
                else:
                    step_size = np.ma.average(np.ma.diff(arr))
                last_good_value = arr[np.logical_not(arr.mask)][-1]
                extrapolation_start = last_good_value+step_size
                n_invalid = np.sum(arr.mask)
                extrapolation_stop = extrapolation_start+step_size*(n_invalid-1)
                arr.unshare_mask()
                arr[arr.mask] = np.linspace(extrapolation_start,
                                            extrapolation_stop,
                                            num=n_invalid)
                arr_shift = np.insert(arr, 0, arr[0])
                arr_shift[0] -= step_size/2
                arr_shift[1:] += step_size/2
                args.append(arr_shift)
            args.append(args_masked[-1])
        else:
            args = args_masked[-1:]
        return args
def _make_args_for_pcolormesh ( args_masked , x , y ) : if x is not None and y is not None : args = [ ] for k , arr in enumerate ( args_masked [ : - 1 ] ) : if arr . ndim > 1 : arr = arr [ 0 ] if k == 0 else arr [ : , 0 ] if np . ma . is_masked ( arr [ 1 ] ) : step_size = 1. else : step_size = np . ma . average ( np . ma . diff ( arr ) ) last_good_value = arr [ np . logical_not ( arr . mask ) ] [ - 1 ] extrapolation_start = last_good_value + step_size n_invalid = np . sum ( arr . mask ) extrapolation_stop = extrapolation_start + step_size * ( n_invalid - 1 ) arr . unshare_mask ( ) arr [ arr . mask ] = np . linspace ( extrapolation_start , extrapolation_stop , num = n_invalid ) arr_shift = np . insert ( arr , 0 , arr [ 0 ] ) arr_shift [ 0 ] -= step_size / 2 arr_shift [ 1 : ] += step_size / 2 args . append ( arr_shift ) args . append ( args_masked [ - 1 ] ) else : args = args_masked [ - 1 : ] return args
Make args for pcolormesh.
Make args for pcolormesh .
"""
        Make args for pcolormesh.
        pcolormesh accepts as args either
        C - a (potentially) masked array
        or
        x, y, C where x and y are the colour box edge arrays and
        are NOT allowed to be masked
        """ # If x and y are provided, modify the arrays such that they # correspond to grid corners instead of grid centers. # This is to ensure that pcolormesh centers correctly and # does not ignore edge points. # If a two-dimensional array is provided, only consider the # first row/column, depending on the axis # first extrapolate to fill any empty values Matplotlib 2.2 no # longer support nans in x and y for pcolormesh. # Only the first element is not nan. We have to guess the # step size # the average stepsize is our best guess # numpy (1.14) has a deprecation warning related to shared # masks. Let's silence this by making sure that this is # not shared before modifying the mask # Now shift array to get edge coordinates rather than # centre coordinates # Only the masked value of z is used as a mask
args_masked
x
y