• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python image.BboxImage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中matplotlib.image.BboxImage的典型用法代码示例。如果您正苦于以下问题:Python BboxImage类的具体用法?Python BboxImage怎么用?Python BboxImage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了BboxImage类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: imagesAtPositions

def imagesAtPositions(ax, images, positions):
    for s in range(len(positions)):
        #print(positions[s,:])
        bbox = Bbox(corners(ax, positions[s,:],20))
        bbox_image = BboxImage(bbox)
        image = imread(images[s])
        bbox_image.set_data(image)
        ax.add_artist(bbox_image)
开发者ID:ilogue,项目名称:pyrsa,代码行数:8,代码来源:imagesAsTickMarks.py


示例2: _init_bbox_image

 def _init_bbox_image(self, im):
     bbox_image = BboxImage(self.get_window_extent,
                            norm = None,
                            origin=None,
                            )
     bbox_image.set_transform(IdentityTransform())
     bbox_image.set_data(im)
     self.bbox_image = bbox_image
开发者ID:,项目名称:,代码行数:8,代码来源:


示例3: draw

 def draw(self, renderer, *args, **kwargs):
     bbox = self.get_window_extent(renderer)
     stretch_factor = bbox.height / bbox.width
     ny = int(stretch_factor*self._ribbonbox.nx)
     if self._cached_ny != ny:
         arr = self._ribbonbox.get_stretched_image(stretch_factor)
         self.set_array(arr)
         self._cached_ny = ny
     BboxImage.draw(self, renderer, *args, **kwargs)
开发者ID:debbiespiegel,项目名称:salstat-statistics-package-2,代码行数:9,代码来源:graficaRibon.py


示例4: test_bbox_image_inverted

def test_bbox_image_inverted():
    # This is just used to produce an image to feed to BboxImage
    fig = plt.figure()
    axes = fig.add_subplot(111)
    axes.plot([1, 2, 3])

    im_buffer = io.BytesIO()
    fig.savefig(im_buffer)
    im_buffer.seek(0)
    image = imread(im_buffer)

    bbox_im = BboxImage(Bbox([[100, 100], [0, 0]]))
    bbox_im.set_data(image)
    axes.add_artist(bbox_im)
开发者ID:ItsRLuo,项目名称:projectD01,代码行数:14,代码来源:test_image.py


示例5: __init__

    def __init__(self, arr,
                 zoom=1,
                 cmap = None,
                 norm = None,
                 interpolation=None,
                 origin=None,
                 filternorm=1,
                 filterrad=4.0,
                 resample = False,
                 dpi_cor=True,
                 **kwargs
                 ):

        self._dpi_cor = dpi_cor

        self.image = BboxImage(bbox=self.get_window_extent,
                               cmap = cmap,
                               norm = norm,
                               interpolation=interpolation,
                               origin=origin,
                               filternorm=filternorm,
                               filterrad=filterrad,
                               resample = resample,
                               **kwargs
                               )

        self._children = [self.image]

        self.set_zoom(zoom)
        self.set_data(arr)

        OffsetBox.__init__(self)
开发者ID:AlexSzatmary,项目名称:matplotlib,代码行数:32,代码来源:offsetbox.py


示例6: test_bbox_image_inverted

def test_bbox_image_inverted():
    # This is just used to produce an image to feed to BboxImage
    image = np.arange(100).reshape((10, 10))

    ax = plt.subplot(111)
    bbox_im = BboxImage(TransformedBbox(Bbox([[100, 100], [0, 0]]), ax.transData))
    bbox_im.set_data(image)
    bbox_im.set_clip_on(False)
    ax.set_xlim(0, 100)
    ax.set_ylim(0, 100)
    ax.add_artist(bbox_im)

    image = np.identity(10)

    bbox_im = BboxImage(TransformedBbox(Bbox([[0.1, 0.2], [0.3, 0.25]]), ax.figure.transFigure))
    bbox_im.set_data(image)
    bbox_im.set_clip_on(False)
    ax.add_artist(bbox_im)
开发者ID:dashed,项目名称:matplotlib,代码行数:18,代码来源:test_image.py


示例7: imagesAsTickMarks

def imagesAsTickMarks(ax, images):
    TICKYPOS = -.6
    lowerCorner = ax.transData.transform((.8,TICKYPOS-.2))
    upperCorner = ax.transData.transform((1.2,TICKYPOS+.2))
    print(lowerCorner)
    print(upperCorner)
    bbox_image = BboxImage(Bbox([lowerCorner[0],
                                 lowerCorner[1],
                                 upperCorner[0],
                                 upperCorner[1],
                                 ]),
                           norm = None,
                           origin=None,
                           clip_on=False,
                           )

    image = imread(images[0])
    print('img loaded')
    bbox_image.set_data(image)
    ax.add_artist(bbox_image)
开发者ID:ilogue,项目名称:pyrsa,代码行数:20,代码来源:imagesAsTickMarks.py


示例8: __init__

 def __init__(self, bbox, color,
              cmap = None,
              norm = None,
              interpolation=None,
              origin=None,
              filternorm=1,
              filterrad=4.0,
              resample = False,
              **kwargs
              ):
     BboxImage.__init__(self, bbox,
                        cmap = cmap,
                        norm = norm,
                        interpolation=interpolation,
                        origin=origin,
                        filternorm=filternorm,
                        filterrad=filterrad,
                        resample = resample,
                        **kwargs
                        )
     self._ribbonbox = RibbonBox(color)
     self._cached_ny = None
开发者ID:,项目名称:,代码行数:22,代码来源:


示例9: plot_wind_data2

def plot_wind_data2(ax, so, time_nums):

    so.wind_speed = np.array(so.wind_speed)
    wind_speed_max = np.nanmax(so.wind_speed)
    print('max speed', wind_speed_max, len(so.wind_speed))
    
    logo = image.imread('north.png', None)
    bbox2 = Bbox.from_bounds(210, 330, 30, 40)
#     trans_bbox2 = bbox2.transformed(ax.transData)
    bbox_image2 = BboxImage(bbox2)
    bbox_image2.set_data(logo)
    ax.add_image(bbox_image2)
    
#     for x in range(0,len(time_nums),100):
    U = so.u
    V = so.v
    
           
#          if x == max_index:
    Q = ax.quiver(time_nums, -.15, U, V, headlength=0, 
              headwidth=0, headaxislength=0, alpha=1, color='#045a8d', width=.0015, scale=wind_speed_max*5)
    ax.quiverkey(Q, 0.44, 0.84, wind_speed_max * .6,labelpos='N',label = '                                    0 mph                      %.2f mph' % wind_speed_max,
#                    fontproperties={'weight': 'bold'}
       )
开发者ID:cmazzullo,项目名称:wave-sensor,代码行数:24,代码来源:storm_graph_utilities.py


示例10: BboxImage

#plt.gca().get_xaxis().set_ticklabels([])


#    lowerCorner = difP.transData.transform((.8,TICKYPOS-.2))
#    upperCorner = difP.transData.transform((1.2,TICKYPOS+.2))
lowPos = [0,TICKYPOS-1.2]
upPos = [lowPos[0]+1.2,lowPos[1]+1.2]
print lowPos
print upPos
lowerCorner = plt.gca().transData.transform((lowPos[0],lowPos[1]))
upperCorner = plt.gca().transData.transform((upPos[0],upPos[1]))

# first
bbox_image0 = BboxImage(Bbox([[lowerCorner[0], lowerCorner[1]],
                             [upperCorner[0], upperCorner[1]]]),
                   norm = None,
                   origin=None,
                   clip_on=False,
                   )   
bbox_image0.set_data(imread('../thesis/pictures/statePics/set14/set14_0.jpg'))
plt.gca().add_artist(bbox_image0)                       
# second
#lowC1 = plt.gca().transData.transform((lowPos[0]+6.5,lowPos[1]))
#upC1 = plt.gca().transData.transform((upPos[0]+6.5,upPos[1]))
#bbox_image1 = BboxImage(Bbox([[lowC1[0], lowC1[1]],
#                             [upC1[0], upC1[1]]]),
#                   norm = None,
#                   origin=None,
#                   clip_on=False,
#                   )   
#bbox_image1.set_data(imread('../thesis/pictures/statePics/set14/set14_1.jpg'))
#plt.gca().add_artist(bbox_image1)
开发者ID:MuellerDaniel,项目名称:SensGlove,代码行数:32,代码来源:160229_leapDIP.py


示例11: imread

# 	bbox_image.set_data(
# 		imread(
# 			"emoji/images/%s.png" % names[i]
# 		)
# 	)
# 	f.add_artist(bbox_image)
# 	print("emoji/images/%s.png" % names[i])


lowerCorner = f.transData.transform((.8,LABEL_Y_POS-.225))
upperCorner = f.transData.transform((1.2,LABEL_Y_POS+.225))

bbox_image = BboxImage(Bbox([[lowerCorner[0],
                             lowerCorner[1]],
                             [upperCorner[0],
                             upperCorner[1]],
                             ]),
                       norm = None,
                       origin=None,
                       clip_on=False,
                       )

bbox_image.set_data(imread('emoji/images/1f602.png'))
f.add_artist(bbox_image)


# f.xticks(_rl(data), names)
plt.title("emojis!!!")

plt.show()
开发者ID:dor2727,项目名称:Whatsapp,代码行数:30,代码来源:emoji_test_3_me.py


示例12: OffsetImage

class OffsetImage(OffsetBox):
    def __init__(self, arr,
                 zoom=1,
                 cmap = None,
                 norm = None,
                 interpolation=None,
                 origin=None,
                 filternorm=1,
                 filterrad=4.0,
                 resample = False,
                 dpi_cor=True,
                 **kwargs
                 ):

        self._dpi_cor = dpi_cor

        self.image = BboxImage(bbox=self.get_window_extent,
                               cmap = cmap,
                               norm = norm,
                               interpolation=interpolation,
                               origin=origin,
                               filternorm=filternorm,
                               filterrad=filterrad,
                               resample = resample,
                               **kwargs
                               )

        self._children = [self.image]

        self.set_zoom(zoom)
        self.set_data(arr)

        OffsetBox.__init__(self)


    def set_data(self, arr):
        self._data = np.asarray(arr)
        self.image.set_data(self._data)

    def get_data(self):
        return self._data

    def set_zoom(self, zoom):
        self._zoom = zoom

    def get_zoom(self):
        return self._zoom

#     def set_axes(self, axes):
#         self.image.set_axes(axes)
#         martist.Artist.set_axes(self, axes)

#     def set_offset(self, xy):
#         """
#         set offset of the container.

#         Accept : tuple of x,y cooridnate in disokay units.
#         """
#         self._offset = xy

#         self.offset_transform.clear()
#         self.offset_transform.translate(xy[0], xy[1])



    def get_offset(self):
        """
        return offset of the container.
        """
        return self._offset

    def get_children(self):
        return [self.image]

    def get_window_extent(self, renderer):
        '''
        get the bounding box in display space.
        '''
        w, h, xd, yd = self.get_extent(renderer)
        ox, oy = self.get_offset()
        return mtransforms.Bbox.from_bounds(ox-xd, oy-yd, w, h)


    def get_extent(self, renderer):

        if self._dpi_cor: # True, do correction
            dpi_cor = renderer.points_to_pixels(1.)
        else:
            dpi_cor = 1.

        zoom = self.get_zoom()
        data = self.get_data()
        ny, nx = data.shape[:2]
        w, h = nx*zoom, ny*zoom

        return w, h, 0, 0



    def draw(self, renderer):
#.........这里部分代码省略.........
开发者ID:AlexSzatmary,项目名称:matplotlib,代码行数:101,代码来源:offsetbox.py


示例13: ScalarFormatter

    heights = np.random.random(years.shape) * 7000 + 3000

    fmt = ScalarFormatter(useOffset=False)
    ax.xaxis.set_major_formatter(fmt)

    for year, h, bc in zip(years, heights, box_colors):
        bbox0 = Bbox.from_extents(year-0.4, 0., year+0.4, h)
        bbox = TransformedBbox(bbox0, ax.transData)
        rb_patch = RibbonBoxImage(bbox, bc, interpolation="bicubic")

        ax.add_artist(rb_patch)

        ax.annotate(r"%d" % (int(h/100.)*100),
                    (year, h), va="bottom", ha="center")

    patch_gradient = BboxImage(ax.bbox,
                               interpolation="bicubic",
                               zorder=0.1,
                               )
    gradient = np.zeros((2, 2, 4), dtype=np.float)
    gradient[:, :, :3] = [1, 1, 0.]
    gradient[:, :, 3] = [[0.1, 0.3], [0.3, 0.5]]  # alpha channel
    patch_gradient.set_array(gradient)
    ax.add_artist(patch_gradient)

    ax.set_xlim(years[0]-0.5, years[-1]+0.5)
    ax.set_ylim(0, 10000)

    fig.savefig('ribbon_box.png')
    plt.show()
开发者ID:astro-ming,项目名称:matplotlib,代码行数:30,代码来源:demo_ribbon_box.py


示例14: pltshow

else:
    def pltshow(mplpyplot):
        mplpyplot.show()
# nodebox section end

if 1: # __name__ == "__main__":

    fig = plt.figure(1)
    ax = plt.subplot(121)

    txt = ax.text(0.5, 0.5, "test", size=30, ha="center", color="w")
    kwargs = dict()

    bbox_image = BboxImage(txt.get_window_extent,
                           norm=None,
                           origin=None,
                           clip_on=False,
                           **kwargs
                           )
    a = np.arange(256).reshape(1, 256)/256.
    bbox_image.set_data(a)
    ax.add_artist(bbox_image)

    ax = plt.subplot(122)
    a = np.linspace(0, 1, 256).reshape(1, -1)
    a = np.vstack((a, a))

    maps = sorted(
        m for m in plt.cm.cmap_d
        if not m.endswith("_r") and  # Skip reversed colormaps.
        not m.startswith(('spectral', 'Vega'))  # Skip deprecated colormaps.
    )
开发者ID:karstenw,项目名称:nodebox-pyobjc,代码行数:32,代码来源:demo_bboximage.py


示例15: plothist

def plothist(ax=      None,
             xdata= np.arange(4, 9),
             ydata= np.random.random(5),
             labels= [],
             colors = 'random',
             figName='redunca03'):
    if len(xdata) != len(ydata):
        raise StandardError('xdata and ydata must have the same len()')
    
    try:
        IMAGESPATH= os.path.join(wx.GetApp().installDir, 'nicePlot','images')
    except:
        path1= sys.argv[0]
        if os.path.isfile(path1):
            path1= os.path.split(path1)[0]
        path1= path1.decode( sys.getfilesystemencoding())
        if os.path.split( path1)[-1] == 'nicePlot':
            IMAGESPATH= os.path.join( path1, 'images')
        else:
            IMAGESPATH= os.path.join( path1, 'nicePlot', 'images')
           
    # se generan los colores en forma aleatoria
    box_colors = _generatecolors( colors,len( xdata))
    # se genera la figura
    fig = plt.gcf()
    if ax == None:
        ax = plt.gca()
    fmt = ScalarFormatter( useOffset=False)
    ax.xaxis.set_major_formatter( fmt)
    for year, h, bc in zip( xdata, ydata, box_colors):
        bbox0 = Bbox.from_extents(year-0.5, 0.0, year+0.5, h) # year-0.48, 0., year+0.48, year-1 year+1
        bbox = TransformedBbox(bbox0, ax.transData)
        rb_patch = _RibbonBoxImage(bbox, bc, figName, 
                                   path=  os.path.join(IMAGESPATH, 'histplot'),
                                   interpolation="bicubic")
        ax.add_artist(rb_patch)
        if 0:
            if type(h) == type(1):
                ax.annotate(r"%d" % h,
                        (year, h), va="bottom", ha="center")
            elif type(h) == type(1.1):
                ax.annotate(r"%f" % h,
                        (year, h), va="bottom", ha="center")
            elif str(type(h)) == "<type 'numpy.int32'>":
                ax.annotate(r"%d" % h,
                        (year, h), va="bottom", ha="center")
    patch_gradient = BboxImage( ax.bbox,
                               interpolation="bicubic",
                               zorder=0.1,
                               )
    gradient = np.zeros( (2, 2, 4), dtype=np.float)
    gradient[:,:,:3] = [1, 1, 1]
    gradient[:,:,3] = [[0.2, 0.3],[0.2, 0.5]] # alpha channel
    patch_gradient.set_array( gradient)
    ax.add_artist( patch_gradient)
    ax.set_xlim( xdata[0]-1.0, xdata[-1]+1.0)
    # se determinan los limites para el eje Y
    try:
        ydatamax = ydata.max() # en el caso de informacion proveniente de numpy
    except AttributeError:
        ydatamax = max(ydata)
    if ydatamax > 0.0:
        maxYlimit = ydatamax*1.05
    elif ydatamax == 0.0:
        maxYlimit = 1.0
    else:
        maxYlimit = ydatamax*(1.0-0.05)
    ax.set_ylim( 0, maxYlimit)
    return ( fig,plt)
开发者ID:debbiespiegel,项目名称:salstat-statistics-package-2,代码行数:69,代码来源:graficaRibon.py


示例16: plotDif_ind

def plotDif_ind(leap, est, tMag, setName):

    dif = leap - est
    normed = np.linalg.norm(dif, axis=1)
    mean = np.mean(normed)
    std = np.var(normed) ** 2
    #    mean = np.mean(dif,axis=0)
    #    std = np.var(dif, axis=0)**2

    print "mean: %s +- %s" % (mean, std)

    ##Direct input
    plt.rcParams["text.latex.preamble"] = [r"\usepackage{lmodern}"]
    # Options
    params = {
        "text.usetex": True,
        "font.size": 11,
        "font.family": "lmodern",
        "text.latex.unicode": True
        #             'figure.autolayout': True
    }
    plt.rcParams.update(params)
    #
    figHeight = 5
    figWidth = 6
    #
    fig = plt.figure(figsize=(figWidth, figHeight), dpi=300)
    #    plt.figure()

    ax = fig.add_axes([0, 0, figWidth, figHeight], frameon=False)
    #    ax = fig.set_axis_off()

    styleL = ["solid", "dashed", "dotted", "dashdot"]
    if len(est[0]) == 3:
        leap = leap[:, :-1]

    fMCP = plt.subplot(411)
    fMCP.plot(tMag, leap[:, 0], c="r", ls=styleL[0])
    fMCP.plot(tMag, est[:, 0], c="g", ls=styleL[0])
    fMCP.set_ylabel(r"$\theta_{MCP}$ [rad]")
    plt.setp(fMCP.get_xticklabels(), visible=False)

    fPIP = plt.subplot(412, sharey=fMCP, sharex=fMCP)
    fPIP.plot(tMag, leap[:, 1], c="r", ls=styleL[0])
    fPIP.plot(tMag, est[:, 1], c="g", ls=styleL[0])
    fPIP.plot(tMag, leap[:, 2], c="r", ls=styleL[1])
    fPIP.plot(tMag, est[:, 2], c="g", ls=styleL[1])
    fPIP.set_ylabel(r"$\theta_{PIP}$\\ \, $\theta_{DIP}$ [rad]")
    plt.setp(fPIP.get_xticklabels(), visible=False)

    aMCP = plt.subplot(413, sharey=fMCP, sharex=fMCP)
    aMCP.plot(tMag, leap[:, 3], c="r", ls=styleL[0])
    aMCP.plot(tMag, est[:, 3], c="g", ls=styleL[0])
    aMCP.set_ylabel(r"$\phi_{MCP}$ [rad]")
    plt.setp(aMCP.get_xticklabels(), visible=True)

    fMCP.set_title("Difference " + setName)

    difP = plt.subplot(414, sharey=fMCP, sharex=fMCP)
    dif = leap - est
    normedDif = np.linalg.norm(dif, axis=1)

    difP.plot(tMag, normedDif, c="k", ls="-")

    difP.set_ylabel("Normed\nDifference [rad]")
    difP.set_xlabel("Time [sec]")
    difP.set

    plt.xlim([0, tMag[-1] + 1])
    plt.xticks(np.arange(0, tMag[-1], 5))

    linePerf = mlines.Line2D([], [], color="r", markersize=15, label="Leap")
    lineEst = mlines.Line2D([], [], color="g", markersize=15, label="Estimated")
    plt.figlegend((linePerf, lineEst), ("Leap", "Estimated"), loc="upper center")

    #    plt.figlegend((linePerf,lineEst),
    #                  ('Leap','Estimated'), loc='upper center', bbox_to_anchor=(0.5,1.04), ncol=2)

    """ adding the pictures... """
    TICKYPOS = -0.75
    difP.get_xaxis().set_ticklabels([])

    #    lowerCorner = difP.transData.transform((.8,TICKYPOS-.2))
    #    upperCorner = difP.transData.transform((1.2,TICKYPOS+.2))
    lowPos = [-1.6, TICKYPOS - 1.2]
    upPos = [lowPos[0] + 6, lowPos[1] + 1.5]
    print lowPos
    print upPos
    lowerCorner = difP.transData.transform((lowPos[0], lowPos[1]))
    upperCorner = difP.transData.transform((upPos[0], upPos[1]))

    # first
    bbox_image0 = BboxImage(
        Bbox([[lowerCorner[0], lowerCorner[1]], [upperCorner[0], upperCorner[1]]]),
        norm=None,
        origin=None,
        clip_on=False,
    )
    bbox_image0.set_data(imread("../thesis/pictures/statePics/bestLeap/out-0.jpg"))
    difP.add_artist(bbox_image0)
#.........这里部分代码省略.........
开发者ID:MuellerDaniel,项目名称:SensGlove,代码行数:101,代码来源:160229_statePics.py


示例17: plotBar

def plotBar(ax=      None,
            xdata=   np.arange(4, 9),
            ydata=   np.random.random(5),
            labels=  None,
            colors=  'Random',
            figName= 'cilindro',
            path=    None):
    '''box_colors: 'random'|'blue'|'red'|'green'|'ligthgreen'|'darkblue'|'hsv'
    figure: redunca02|blue|aluminio|cilindro| 
    ''' 
    try:
        IMAGESPATH= os.path.join(wx.GetApp().installDir, 'nicePlot','images')
    except:
        path1= sys.argv[0]
        if os.path.isfile(path1):
            path1= os.path.split(path1)[0]
        path1= path1.decode( sys.getfilesystemencoding())
        if os.path.split( path1)[-1] == 'nicePlot':
            IMAGESPATH= os.path.join( path1, 'images')
        else:
            IMAGESPATH= os.path.join( path1, 'nicePlot', 'images')
        
    if len(xdata) != len(ydata):
        raise StandardError('xdata and ydata must have the same len()')
    
    if isinstance(figName,(str,unicode)):
        figName = [figName.lower() for i in range(len(xdata))]
    else:
        figName = [fig.lower() for fig in figName]
    ##xdata,ydata = orderData(xdata,ydata)
    # se generan los colores en forma aleatoria
    box_colors = _generatecolors(colors,len(xdata))           
    fig = plt.gcf()
    if ax == None:
        ax = plt.gca()
    fmt = ScalarFormatter(useOffset= True) #False
    ax.xaxis.set_major_formatter(fmt)
    if labels== None:
        labels = [None for i in ydata]
        
    if path == None:
        path= os.path.relpath(os.path.join(IMAGESPATH,'barplot'))

    for year, h, bc,label,figi in zip(xdata, ydata, box_colors,labels,figName):
        if h < 0: continue
        bbox0 = Bbox.from_extents(year-0.5, 0., year+0.5, h) # year-0.4, 0., year+0.4,
        bbox = TransformedBbox(bbox0, ax.transData)
        rb_patch = _RibbonBoxImage(bbox, bc, figi, path, interpolation='bicubic') #bicubic
        ax.add_artist(rb_patch)
        if isinstance(label,(str,unicode)):
            ax.annotate(label, (year, h), va="bottom", ha="center")
            if type(labels) == type(1):
                ax.annotate(r"%d" % labels,
                        (year, labels), va="bottom", ha="center")
            elif type(labels) == type(1.1):
                ax.annotate(r"%f" % labels,
                        (year, labels), va="bottom", ha="center")
            elif str(type(labels)) == "<type 'numpy.int32'>":
                ax.annotate(r"%d" % labels,
                        (year, labels), va="bottom", ha="center")
                
    patch_gradient = BboxImage(ax.bbox,
                               interpolation= 'bicubic', # "bicubic"
                               zorder=0.1,
                               )
    gradient = np.zeros((2, 2, 4), dtype=np.float)
    gradient[:,:,:3] = [1, 1, 1]
    #gradient[:,:,:3] = [0.5, 0.5, 0.5]
    gradient[:,:,3] = [[0.2, 0.3],[0.2, 0.5]] # alpha channel
    patch_gradient.set_array(gradient)
    ax.add_artist(patch_gradient)
    ax.set_xlim( min(xdata)-0.5, max(xdata)+0.5)
    # se determinan los limites para el eje Y
    if max(ydata) > 0.0:
        maxYlimit = max(ydata)*1.05
    elif max(ydata) == 0.0:
        maxYlimit = 1.0
    else:
        maxYlimit = max(ydata)*(1-0.05)
    ax.set_ylim(min(ydata)*(-0.05), maxYlimit)
    return (fig, plt)
开发者ID:debbiespiegel,项目名称:salstat-statistics-package-2,代码行数:81,代码来源:graficaRibon.py


示例18: Bbox

# -*- coding: utf-8 -*-
import numpy as np
from matplotlib import pyplot as plt
from matplotlib.image import BboxImage
from matplotlib.transforms import Bbox, TransformedBbox

img = np.random.randint(0, 255, (100, 200, 3))

print img.shape


ax = plt.subplot()

loc = np.array([[0, 0], [200.0, 100.0]])
bbox0 = Bbox(loc)
bbox = TransformedBbox(bbox0, ax.transData)

bbox_image = BboxImage(bbox)
bbox_image.set_data(img)

ax.add_artist(bbox_image)
bbox_image.bbox._bbox.set_points(loc + [10, 5])
bbox_image.bbox.invalidate()
ax.set_xlim(-10, 210)
ax.set_ylim(-10, 110)
ax.axis("off")
plt.show()
开发者ID:YaoC,项目名称:scpy2,代码行数:27,代码来源:ttt.py


示例19: BboxImage

ax.add_patch(patches.Rectangle((8-.1,TICKYPOS-.05),.2,.2,
															 fill=False,clip_on=False))

ticks = [0,2,4,6,8]

a = []

for i in ticks[:2]:
	lowerCorner = ax.transData.transform(((i+1-.225),TICKYPOS-.225))
	# lowerCorner = ax.transData.transform((0.775,TICKYPOS-.225))
	upperCorner = ax.transData.transform(((i+1+.225),TICKYPOS+.225))
	# upperCorner = ax.transData.transform((1.225,TICKYPOS+.225))

	bbox_image = BboxImage(Bbox([[lowerCorner[0],
								 lowerCorner[1]],
								 [upperCorner[0],
								 upperCorner[1]],
								 ]),
								 norm = None,
								 origin=None,
								 clip_on=False,
								 )

	bbox_image.set_data(imread('emoji/images/%s.png' % names[i]))
	a.append(bbox_image)
	ax.add_artist(bbox_image)

plt.xticks(_rl(a), a)

plt.show()
开发者ID:dor2727,项目名称:Whatsapp,代码行数:30,代码来源:emoji_test_4_me.py



注:本文中的matplotlib.image.BboxImage类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python image.NonUniformImage类代码示例发布时间:2022-05-27
下一篇:
Python image.thumbnail函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap