Plotting of the coordination environments of a given site for all the distfactor/angfactor regions. The
        chemical environments with the lowest continuous symmetry measure is shown for each distfactor/angfactor
        region as the value for the color of that distfactor/angfactor region (using a colormap).
        :param isite: Index of the site for which the plot has to be done
        :param plot_type: How to plot the coordinations
        :param title: Title for the figure
        :param max_dist: Maximum distance to be plotted when the plotting of the distance is set to 'initial_normalized'
                         or 'initial_real' (Warning: this is not the same meaning in both cases! In the first case,
                         the closest atom lies at a "normalized" distance of 1.0 so that 2.0 means refers to this
                         normalized distance while in the second case, the real distance is used)
        :param figsize: Size of the figure to be plotted
        :return: The figure object to be plotted or saved to file

def get_environments_figure(self, isite, plot_type=None, title='Coordination numbers', max_dist=2.0,
                                additional_condition=AC.ONLY_ACB, colormap=None, figsize=None,
                                strategy=None):
        """
        Plotting of the coordination environments of a given site for all the distfactor/angfactor regions. The
        chemical environments with the lowest continuous symmetry measure is shown for each distfactor/angfactor
        region as the value for the color of that distfactor/angfactor region (using a colormap).
        :param isite: Index of the site for which the plot has to be done
        :param plot_type: How to plot the coordinations
        :param title: Title for the figure
        :param max_dist: Maximum distance to be plotted when the plotting of the distance is set to 'initial_normalized'
                         or 'initial_real' (Warning: this is not the same meaning in both cases! In the first case,
                         the closest atom lies at a "normalized" distance of 1.0 so that 2.0 means refers to this
                         normalized distance while in the second case, the real distance is used)
        :param figsize: Size of the figure to be plotted
        :return: The figure object to be plotted or saved to file
        """
        try:
            import matplotlib.pyplot as mpl
            from matplotlib import cm
            from matplotlib.colors import Normalize, LinearSegmentedColormap, ListedColormap
            from matplotlib.patches import Rectangle, Polygon
        except ImportError:
            print('Plotting Chemical Environments requires matplotlib ... exiting "plot" function')
            return

        #Initializes the figure
        if figsize is None:
            fig = mpl.figure()
        else:
            fig = mpl.figure(figsize=figsize)
        subplot = fig.add_subplot(111)

        #Initializes the distance and angle parameters
        if plot_type is None:
            plot_type = {'distance_parameter': ('initial_normalized', None),
                         'angle_parameter': ('initial_normalized_inverted', None)}
        if colormap is None:
            mycm = cm.jet
        else:
            mycm = colormap
        mymin = 0.0
        mymax = 10.0
        norm = Normalize(vmin=mymin, vmax=mymax)
        scalarmap = cm.ScalarMappable(norm=norm, cmap=mycm)
        dist_limits = [1.0, max_dist]
        ang_limits = [0.0, 1.0]
        if plot_type['distance_parameter'][0] == 'one_minus_inverse_alpha_power_n':
            if plot_type['distance_parameter'][1] is None:
                exponent = 3
            else:
                exponent = plot_type['distance_parameter'][1]['exponent']
            xlabel = 'Distance parameter : $1.0-\\frac{{1.0}}{{\\alpha^{{{:d}}}}}$'.format(exponent)
            def dp_func(dp):
                return 1.0-1.0/np.power(dp, exponent)
        elif plot_type['distance_parameter'][0] == 'initial_normalized':
            xlabel = 'Distance parameter : $\\alpha$'
            def dp_func(dp):
                return dp
        else:
            raise ValueError('Wrong value for distance parameter plot type "{}"'.
                             format(plot_type['distance_parameter'][0]))

        if plot_type['angle_parameter'][0] == 'one_minus_gamma':
            ylabel = 'Angle parameter : $1.0-\\gamma$'
            def ap_func(ap):
                return 1.0-ap
        elif plot_type['angle_parameter'][0] in ['initial_normalized_inverted', 'initial_normalized']:
            ylabel = 'Angle parameter : $\\gamma$'
            def ap_func(ap):
                return ap
        else:
            raise ValueError('Wrong value for angle parameter plot type "{}"'.
                             format(plot_type['angle_parameter'][0]))
        dist_limits = [dp_func(dp) for dp in dist_limits]
        ang_limits = [ap_func(ap) for ap in ang_limits]

        for cn, cn_nb_sets in self.neighbors_sets[isite].items():
            for inb_set, nb_set in enumerate(cn_nb_sets):
                nb_set_surface_pts = nb_set.voronoi_grid_surface_points()
                if nb_set_surface_pts is None:
                    continue
                ce = self.ce_list[isite][cn][inb_set]
                if ce is None:
                    mycolor = 'w'
                    myinvcolor = 'k'
                    mytext = '{:d}'.format(cn)
                else:
                    mingeom = ce.minimum_geometry()
                    if mingeom is not None:
                        mp_symbol = mingeom[0]
                        csm = mingeom[1]['symmetry_measure']
                        mycolor = scalarmap.to_rgba(csm)
                        myinvcolor = [1.0 - mycolor[0], 1.0 - mycolor[1], 1.0 - mycolor[2], 1.0]
                        mytext = '{}'.format(mp_symbol)
                    else:
                        mycolor = 'w'
                        myinvcolor = 'k'
                        mytext = '{:d}'.format(cn)
                nb_set_surface_pts = [(dp_func(pt[0]), ap_func(pt[1])) for pt in nb_set_surface_pts]
                polygon = Polygon(nb_set_surface_pts, closed=True, edgecolor='k', facecolor=mycolor, linewidth=1.2)
                subplot.add_patch(polygon)
                myipt = len(nb_set_surface_pts) / 2
                ipt = int(myipt)
                if myipt != ipt:
                    raise RuntimeError('Number of surface points not even')
                patch_center = ((nb_set_surface_pts[0][0] + min(nb_set_surface_pts[ipt][0], dist_limits[1])) / 2,
                                (nb_set_surface_pts[0][1] + nb_set_surface_pts[ipt][1]) / 2)

                if (np.abs(nb_set_surface_pts[-1][1] - nb_set_surface_pts[-2][1]) > 0.06 and
                      np.abs(min(nb_set_surface_pts[-1][0], dist_limits[1]) - nb_set_surface_pts[0][0]) > 0.125):
                    xytext = ((min(nb_set_surface_pts[-1][0], dist_limits[1]) + nb_set_surface_pts[0][0]) / 2,
                              (nb_set_surface_pts[-1][1] + nb_set_surface_pts[-2][1]) / 2)
                    subplot.annotate(mytext, xy=xytext,
                                     ha='center', va='center', color=myinvcolor, fontsize='x-small')
                elif (np.abs(nb_set_surface_pts[ipt][1] - nb_set_surface_pts[0][1]) > 0.1 and
                    np.abs(min(nb_set_surface_pts[ipt][0], dist_limits[1]) - nb_set_surface_pts[0][0]) > 0.125):
                    xytext = patch_center
                    subplot.annotate(mytext, xy=xytext,
                                     ha='center', va='center', color=myinvcolor, fontsize='x-small')

        subplot.set_title(title)
        subplot.set_xlabel(xlabel)
        subplot.set_ylabel(ylabel)

        dist_limits.sort()
        ang_limits.sort()
        subplot.set_xlim(dist_limits)
        subplot.set_ylim(ang_limits)
        if strategy is not None:
            try:
                strategy.add_strategy_visualization_to_subplot(subplot=subplot)
            except:
                pass
        if plot_type['angle_parameter'][0] == 'initial_normalized_inverted':
            subplot.axes.invert_yaxis()

        scalarmap.set_array([mymin, mymax])
        cb = fig.colorbar(scalarmap, ax=subplot, extend='max')
        cb.set_label('Continuous symmetry measure')
        return fig, subplot