Пример #1
0
    def _get_handles(self, handles, texts):
        HEIGHT = self._approx_text_height()

        ret = []  # the returned legend lines
        for handle, label in zip(handles, texts):
            x, y = label.get_position()
            x -= self.HANDLELEN + self.HANDLETEXTSEP
            if isinstance(handle, Line2D):
                ydata = (y - HEIGHT / 2) * ones(self._xdata.shape, Float)
                legline = Line2D(self._xdata, ydata)
                self._set_artist_props(legline)
                legline.copy_properties(handle)
                legline.set_markersize(0.6 * legline.get_markersize())
                legline.set_data_clipping(False)
                ret.append(legline)
            elif isinstance(handle, Patch):

                p = Rectangle(
                    xy=(min(self._xdata), y - 3 / 4 * HEIGHT),
                    width=self.HANDLELEN,
                    height=HEIGHT / 2,
                )
                self._set_artist_props(p)
                p.copy_properties(handle)
                ret.append(p)
            else:
                ret.append(None)

        return ret
Пример #2
0
    def _get_handles(self, handles, texts):
        HEIGHT = self._approx_text_height()

        ret = []  # the returned legend lines
        for handle, label in zip(handles, texts):
            x, y = label.get_position()
            x -= self.HANDLELEN + self.HANDLETEXTSEP
            if isinstance(handle, Line2D):
                ydata = (y - HEIGHT / 2) * ones(self._xdata.shape, Float)
                legline = Line2D(self._xdata, ydata)
                self._set_artist_props(legline)
                legline.copy_properties(handle)
                legline.set_markersize(0.6 * legline.get_markersize())
                legline.set_data_clipping(False)
                ret.append(legline)
            elif isinstance(handle, Patch):

                p = Rectangle(xy=(min(self._xdata), y - 3 / 4 * HEIGHT), width=self.HANDLELEN, height=HEIGHT / 2)
                self._set_artist_props(p)
                p.copy_properties(handle)
                ret.append(p)
            else:
                ret.append(None)

        return ret
Пример #3
0
    def _get_handles(self, handles, texts):
        HEIGHT = self._approx_text_height()

        ret = []  # the returned legend lines

        for handle, label in zip(handles, texts):
            x, y = label.get_position()
            x -= self.handlelen + self.handletextsep
            if isinstance(handle, Line2D):
                ydata = (y - HEIGHT / 2) * ones(self._xdata.shape, Float)
                legline = Line2D(self._xdata, ydata)
                self._set_artist_props(legline)
                legline.copy_properties(handle)
                legline.set_markersize(0.6 * legline.get_markersize())
                legline.set_data_clipping(False)
                ret.append(legline)
            elif isinstance(handle, Patch):

                p = Rectangle(
                    xy=(min(self._xdata), y - 3 / 4 * HEIGHT),
                    width=self.handlelen,
                    height=HEIGHT / 2,
                )
                p.copy_properties(handle)
                self._set_artist_props(p)
                ret.append(p)
            elif isinstance(handle, LineCollection):
                ydata = (y - HEIGHT / 2) * ones(self._xdata.shape, Float)
                legline = Line2D(self._xdata, ydata)
                self._set_artist_props(legline)
                lw = handle.get_linewidths()[0]
                color = handle.get_colors()[0]
                legline.set_color(color)
                legline.set_linewidth(lw)
                ret.append(legline)

            else:
                ret.append(None)

        return ret
Пример #4
0
    def _get_handles(self, handles, texts):
        HEIGHT = self._approx_text_height()

        ret = []   # the returned legend lines

        for handle, label in zip(handles, texts):
            x, y = label.get_position()
            x -= self.handlelen + self.handletextsep
            if isinstance(handle, Line2D):
                ydata = (y-HEIGHT/2)*ones(self._xdata.shape, Float)
                legline = Line2D(self._xdata, ydata)
                self._set_artist_props(legline)
                legline.copy_properties(handle)
                legline.set_markersize(self.markerscale*legline.get_markersize())
                legline.set_data_clipping(False)
                ret.append(legline)
            elif isinstance(handle, Patch):

                p = Rectangle(xy=(min(self._xdata), y-3/4*HEIGHT),
                              width = self.handlelen, height=HEIGHT/2,
                              )
                p.copy_properties(handle)
                self._set_artist_props(p)
                ret.append(p)
            elif isinstance(handle, LineCollection):
                ydata = (y-HEIGHT/2)*ones(self._xdata.shape, Float)
                legline = Line2D(self._xdata, ydata)
                self._set_artist_props(legline)
                lw = handle.get_linewidths()[0]
                color = handle.get_colors()[0]                
                legline.set_color(color)
                legline.set_linewidth(lw)
                ret.append(legline)
                
	    else:
		ret.append(None)
                                               
        return ret