(marker, size=None)
return texture
Create a marker texture.
Create a marker texture.
Create a marker texture .
def get_marker_texture(marker, size=None):
    """Create a marker texture."""
    # if size is None:
        # size = 1
        
    if marker == '.':
        marker = ','
        if size is None:
            size = 2
    
    if size is None:
        if marker == ',':
            size = 1
        else:
            size = 5
        
    texture = np.zeros((size, size, 4))
    
    if marker == ',':
        texture[:] = 1
        
    elif marker == '+':
        # force odd number
        size -= (np.mod(size, 2) - 1)
        texture[size / 2, :, :] = 1
        texture[:, size / 2, :] = 1
        
    elif marker == 'x':
        # force even number
        size -= (np.mod(size, 2))
        texture[range(size), range(size), :] = 1
        texture[range(size - 1, -1, -1), range(size), :] = 1
        
    elif marker == '-':
        texture[size / 2, :, :] = 1
        
    elif marker == '|':
        texture[:, size / 2, :] = 1
        
    elif marker == 'o':
        # force even number
        size -= (np.mod(size, 2))
        # fill with white
        texture[:, :, :-1] = 1
        x = np.linspace(-1., 1., size)
        X, Y = np.meshgrid(x, x)
        R = X ** 2 + Y ** 2
        R = np.minimum(1, 20 * np.exp(-8*R))
        # disc-shaped alpha channel
        texture[:size,:size,-1] = R
    
    return texture
def get_marker_texture ( marker , size = None ) : # if size is None: # size = 1 if marker == '.' : marker = ',' if size is None : size = 2 if size is None : if marker == ',' : size = 1 else : size = 5 texture = np . zeros ( ( size , size , 4 ) ) if marker == ',' : texture [ : ] = 1 elif marker == '+' : # force odd number size -= ( np . mod ( size , 2 ) - 1 ) texture [ size / 2 , : , : ] = 1 texture [ : , size / 2 , : ] = 1 elif marker == 'x' : # force even number size -= ( np . mod ( size , 2 ) ) texture [ range ( size ) , range ( size ) , : ] = 1 texture [ range ( size - 1 , - 1 , - 1 ) , range ( size ) , : ] = 1 elif marker == '-' : texture [ size / 2 , : , : ] = 1 elif marker == '|' : texture [ : , size / 2 , : ] = 1 elif marker == 'o' : # force even number size -= ( np . mod ( size , 2 ) ) # fill with white texture [ : , : , : - 1 ] = 1 x = np . linspace ( - 1. , 1. , size ) X , Y = np . meshgrid ( x , x ) R = X ** 2 + Y ** 2 R = np . minimum ( 1 , 20 * np . exp ( - 8 * R ) ) # disc-shaped alpha channel texture [ : size , : size , - 1 ] = R return texture