Example #1
0
 def scatter(self, *args, **kwargs):
     """
     Make a scatter plot on a map.
     
     :param x: (*array_like*) Input x data.
     :param y: (*array_like*) Input y data.
     :param z: (*array_like*) Input z data.
     :param levs: (*array_like*) Optional. A list of floating point numbers indicating the level curves 
         to draw, in increasing order.
     :param cmap: (*string*) Color map string.
     :param colors: (*list*) If None (default), the colormap specified by cmap will be used. If a 
         string, like ‘r’ or ‘red’, all levels will be plotted in this color. If a tuple, different 
         levels will be plotted in different colors in the order specified.
     :param size: (*int of list*) Marker size.
     :param marker: (*string*) Marker of the points.
     :param fill: (*boolean*) Fill markers or not. Default is True.
     :param edge: (*boolean*) Draw edge of markers or not. Default is True.
     :param facecolor: (*Color*) Fill color of markers. Default is black.
     :param edgecolor: (*Color*) Edge color of markers. Default is black.
     :param proj: (*ProjectionInfo*) Map projection of the data. Default is None.
     :param zorder: (*int*) Z-order of created layer for display.
     
     :returns: (*VectoryLayer*) Point VectoryLayer.
     """
     n = len(args) 
     if n == 1:
         a = args[0]
         y = a.dimvalue(0)
         x = a.dimvalue(1)
         args = args[1:]
     else:
         x = args[0]
         y = args[1]
         if not isinstance(x, MIArray):
             x = minum.array(x)
         if not isinstance(y, MIArray):
             y = minum.array(y)
         if n == 2:
             a = x
             args = args[2:]
         else:
             a = args[2]
             if not isinstance(a, MIArray):
                 a = minum.array(a)
             args = args[3:]
     
     ls = kwargs.pop('symbolspec', None)
     if ls is None:
         isunique = False
         colors = kwargs.get('colors', None) 
         if not colors is None:
             if isinstance(colors, (list, tuple)) and len(colors) == len(x):
                 isunique = True
         size = kwargs.get('size', None)
         if not size is None:
             if isinstance(size, (list, tuple, MIArray)) and len(size) == len(x):
                 isunique = True
         if isunique:
             ls = LegendManage.createUniqValueLegendScheme(len(x), ShapeTypes.Point)
         else:
             ls = plotutil.getlegendscheme(args, a.min(), a.max(), **kwargs)
         ls = plotutil.setlegendscheme_point(ls, **kwargs)
     
     if a.size == ls.getBreakNum() and ls.getLegendType() == LegendType.UniqueValue:
         layer = DrawMeteoData.createSTPointLayer_Unique(a.array, x.array, y.array, ls, 'layer', 'data')
     else:
         layer = DrawMeteoData.createSTPointLayer(a.array, x.array, y.array, ls, 'layer', 'data')
     
     proj = kwargs.pop('proj', None)
     if not proj is None:
         layer.setProjInfo(proj)
     avoidcoll = kwargs.pop('avoidcoll', None)
     if not avoidcoll is None:
         layer.setAvoidCollision(avoidcoll)
     
     # Add layer
     isadd = kwargs.pop('isadd', True)
     if isadd:
         zorder = kwargs.pop('zorder', None)
         select = kwargs.pop('select', True)
         self.add_layer(layer, zorder, select)
         self.axes.setDrawExtent(layer.getExtent().clone())
         self.axes.setExtent(layer.getExtent().clone())
     
     return MILayer(layer)