ipygee.ee_feature_collection ============================ .. py:module:: ipygee.ee_feature_collection .. autoapi-nested-parse:: Toolbox for the :py:class:`ee.FeatureCollection` class. Classes ------- .. autoapisummary:: ipygee.ee_feature_collection.FeatureCollectionAccessor Module Contents --------------- .. py:class:: FeatureCollectionAccessor(obj) Initialize the FeatureCollectionAccessor class. .. py:method:: plot_by_features(type = 'bar', featureId = 'system:index', properties = None, labels = None, colors = None, figure = None, **kwargs) Plot the values of a :py:class:`ee.FeatureCollection` by feature. Each feature property selected in properties will be plotted using the ``featureId`` as the x-axis. If no ``properties`` are provided, all properties will be plotted. If no ``featureId`` is provided, the ``"system:index"`` property will be used. .. warning:: This function is a client-side function. :param type: The type of plot to use. Defaults to ``"bar"``. can be any type of plot from the python lib ``matplotlib.pyplot``. If the one you need is missing open an issue! :param featureId: The property to use as the x-axis (name the features). Defaults to ``"system:index"``. :param properties: A list of properties to plot. Defaults to all properties. :param labels: A list of labels to use for plotting the properties. If not provided, the default labels will be used. It needs to match the properties' length. :param colors: A list of colors to use for plotting the properties. If not provided, the default colors from the matplotlib library will be used. :param figure: The bokeh figure to plot the data on. If None, a new figure is created. :param kwargs: Additional arguments from the ``pyplot`` type selected. .. rubric:: Examples .. jupyter-execute:: import ee, geetools from geetools.utils import initialize_documentation from matplotlib import pyplot as plt initialize_documentation() # start a plot object from matplotlib library fig, ax = plt.subplots(figsize=(10, 5)) # plot on this object the 10 first items of the FAO GAUL level 2 feature collection # for each one of them (marked with it's "ADM0_NAME" property) we plot the value of the "ADM1_CODE" and "ADM2_CODE" properties fc = ee.FeatureCollection("FAO/GAUL/2015/level2").limit(10) fc.geetools.plot_by_features(featureId="ADM2_NAME", properties=["ADM1_CODE", "ADM2_CODE"], colors=["#61A0D4", "#D49461"], ax=ax) # Modify the rotation of existing x-axis tick labels for label in ax.get_xticklabels(): label.set_rotation(45) .. py:method:: plot_by_properties(type = 'bar', featureId = 'system:index', properties = None, labels = None, colors = None, figure = None, **kwargs) Plot the values of a :py:class:`ee.FeatureCollection` by property. Each features will be represented by a color and each property will be a bar of the bar chart. .. warning:: This function is a client-side function. :param type: The type of plot to use. Defaults to ``"bar"``. can be any type of plot from the python lib ``matplotlib.pyplot``. If the one you need is missing open an issue! :param featureId: The property to use as the y-axis (name the features). Defaults to ``"system:index"``. :param properties: A list of properties to plot. Defaults to all properties. :param labels: A list of labels to use for plotting the properties. If not provided, the default labels will be used. It needs to match the properties' length. :param colors: A list of colors to use for plotting the properties. If not provided, the default colors from the matplotlib library will be used. :param figure: The bokeh figure to plot the data on. If None, a new figure is created. :param kwargs: Additional arguments from the ``pyplot`` function. .. rubric:: Examples .. jupyter-execute:: import ee, ipygee from geetools.utils import initialize_documentation from matplotlib import pyplot as plt initialize_documentation() # start a plot object from matplotlib library fig, ax = plt.subplots(figsize=(10, 5)) # plot on this object the 10 first items of the FAO GAUL level 2 feature collection # for each one of them (marked with it's "ADM2_NAME" property) we plot the value of the "ADM1_CODE" property fc = ee.FeatureCollection("FAO/GAUL/2015/level2").limit(10) fc.bokeh.plot_by_properties(featureId="ADM2_NAME", properties=["ADM1_CODE"], ax=ax) .. py:method:: plot_hist(property, label = '', figure = None, color = None, **kwargs) Plot the histogram of a specific property. .. warning:: This function is a client-side function. :param property: The property to display :param label: The label to use for the property. If not provided, the property name will be used. :param figure: The bokeh figure to plot the data on. If None, a new figure is created. :param color: The color to use for the plot. If not provided, the default colors from the matplotlib library will be used. :param \*\*kwargs: Additional arguments from the :py:func:`matplotlib.pyplot.hist` function. .. rubric:: Examples .. jupyter-execute:: import ee, ipygee from geetools.utils import initialize_documentation from matplotlib import pyplot as plt initialize_documentation() # start a plot object from matplotlib library fig, ax = plt.subplots(figsize=(10, 5)) ax.set_title('Histogram of Precipitation in July') ax.set_xlabel('Precipitation (mm)') # build the histogram of the precipitation band for the month of july in the PRISM dataset normClim = ee.ImageCollection('OREGONSTATE/PRISM/Norm81m').toBands() region = ee.Geometry.Rectangle(-123.41, 40.43, -116.38, 45.14) climSamp = normClim.sample(region, 5000) climSamp.ipygee.plot_hist("07_ppt", ax=ax, bins=20) fig.show() .. py:attribute:: _obj