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

Python cbook.get_sample_data函数代码示例

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

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



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

示例1: show

def show(location_summaries, ap_names, ap_macs):
    datafile = cbook.get_sample_data('C:/Dev/android/WifiRecord/app/src/main/res/drawable/greenstone_lower.png')
    lower_img = imread(datafile)
    lower_img_flip = lower_img[::-1, :, :]
    lower_img_faded = (255*0.7 + lower_img_flip*0.3).astype('uint8')
    datafile = cbook.get_sample_data('C:/Dev/android/WifiRecord/app/src/main/res/drawable/greenstone_upper.png')
    upper_img = imread(datafile)
    upper_img_flip = upper_img[::-1, :, :]
    upper_img_faded = (255*0.7 + upper_img_flip*0.3).astype('uint8')
    
    fig, (ax_upper, ax_lower) = plt.subplots(2, 1)
    #mng = plt.get_current_fig_manager()
    #mng.full_screen_toggle()
    
    for (num, name) in ap_names.iteritems():
#        if num>=1:
#            break
        ax_upper.cla()
        ax_upper.imshow(upper_img_faded, zorder=0, extent=[0, 2200, 0, 1054])    
        ax_upper.set_xlim(400, 1800) 
        ax_upper.set_ylim(800, 400) 
        
        ax_lower.cla()
        ax_lower.imshow(lower_img_faded, zorder=0, extent=[0, 2200, 0, 760])
        ax_lower.axis([300, 1000, 100, 500])
        ax_lower.set_ylim(500, 100) 
        
        add_points(ax_upper, ax_lower, num, name, location_summaries)
        
        plt.draw()
        time.sleep(0.25)         
开发者ID:JamesLTaylor,项目名称:wifi_ps,代码行数:31,代码来源:visualize_greenstone.py


示例2: showImage

def showImage(ax,
              filename,
              title='',
              label='',
              label_color='black',
              fontsize=DEFAULT_FONTSIZE,
              rotate=False,
              label_position=(0.05,0.95),
              dpi=None,
              ):
    from matplotlib import pyplot as plt
    import matplotlib.cbook as cbook
    setLabel(ax,
             label,
             color=label_color,
             fontsize=fontsize,
             position=label_position,
             dpi=dpi,
             )
    image_file = cbook.get_sample_data(abspath(filename))
    image = plt.imread(image_file)
    if rotate:
        image = np.transpose(image, (1,0,2))
    im = ax.imshow(image)
    ax.axis('off')
    ax.set_title(title, fontsize=fontsize)

    return im
开发者ID:engelund,项目名称:CalcTroll,代码行数:28,代码来源:Visualizations.py


示例3: __display_image__

    def __display_image__(self,subject_id,args_l,kwargs_l,block=True,title=None):
        """
        return the file names for all the images associated with a given subject_id
        also download them if necessary
        :param subject_id:
        :return:
        """
        subject = self.subject_collection.find_one({"zooniverse_id": subject_id})
        url = subject["location"]["standard"]

        slash_index = url.rfind("/")
        object_id = url[slash_index+1:]

        if not(os.path.isfile(self.base_directory+"/Databases/"+self.project+"/images/"+object_id)):
            urllib.urlretrieve(url, self.base_directory+"/Databases/"+self.project+"/images/"+object_id)

        fname = self.base_directory+"/Databases/"+self.project+"/images/"+object_id

        image_file = cbook.get_sample_data(fname)
        image = plt.imread(image_file)

        fig, ax = plt.subplots()
        im = ax.imshow(image,cmap = cm.Greys_r)

        for args,kwargs in zip(args_l,kwargs_l):
            print args,kwargs
            ax.plot(*args,**kwargs)

        if title is not None:
            ax.set_title(title)
        plt.show(block=block)
开发者ID:JiaminXuan,项目名称:aggregation,代码行数:31,代码来源:ouroboros_api.py


示例4: get_demo_image

def get_demo_image():
    import numpy as np
    from matplotlib.cbook import get_sample_data
    f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False)
    z = np.load(f)
    # z is a numpy array of 15x15
    return z, (-3, 4, -4, 3)
开发者ID:DanHickstein,项目名称:matplotlib,代码行数:7,代码来源:demo_axes_divider.py


示例5: Scatter

def Scatter():
    """
    Demo of scatter plot with varying marker colors and sizes.
    """
    import numpy as np
    import matplotlib.pyplot as plt
    import matplotlib.cbook as cbook
    
    # Load a numpy record array from yahoo csv data with fields date,
    # open, close, volume, adj_close from the mpl-data/example directory.
    # The record array stores python datetime.date as an object array in
    # the date column
    datafile = cbook.get_sample_data('goog.npy')
    price_data = np.load(datafile).view(np.recarray)
    price_data = price_data[-250:] # get the most recent 250 trading days
    
    delta1 = np.diff(price_data.adj_close)/price_data.adj_close[:-1]
    
    # Marker size in units of points^2
    volume = (15 * price_data.volume[:-2] / price_data.volume[0])**2
    close = 0.003 * price_data.close[:-2] / 0.003 * price_data.open[:-2]
    
    fig, ax = plt.subplots()
    ax.scatter(delta1[:-1], delta1[1:], c=close, s=volume, alpha=0.5)
    
    ax.set_xlabel(r'$\Delta_i$', fontsize=20)
    ax.set_ylabel(r'$\Delta_{i+1}$', fontsize=20)
    ax.set_title('Volume and percent change')
    
    ax.grid(True)
    fig.tight_layout()
    
    plt.show()
开发者ID:luwy007,项目名称:MatPlotLib,代码行数:33,代码来源:MatPlotLib.py


示例6: mapPerPeriod

def mapPerPeriod(aodperDegree, lats, longs, title, savefile, cmapname,minv=0,maxv=0):
    # Make plot with vertical (default) colorbar
  
    fig, ax = plt.subplots()

    data = aodperDegree
    datafile = cbook.get_sample_data('C:/Users/alex/marspython/aerosol/gr.png')
    img = imread(datafile)

    ax.imshow(img, zorder=1, alpha=0.3,
              extent=[float(min(longs))-0.5, float(max(longs))+0.5, float(min(lats)) - 0.5, float(max(lats))+0.5])

    if minv<>0 or maxv<>0 :
        cax = ax.imshow(data, zorder=0, interpolation='spline16', cmap=cm.get_cmap(cmapname),
                    extent=[float(min(longs)), float(max(longs)), float(min(lats)), float(max(lats))],
                    vmin=minv,vmax=maxv)
    else:
        cax = ax.imshow(data, zorder=0, interpolation='spline16', cmap=cm.get_cmap(cmapname),
                    extent=[float(min(longs)), float(max(longs)), float(min(lats)), float(max(lats))])
    ax.set_title(title)

    # Add colorbar, make sure to specify tick locations to match desired ticklabels
    #cbar = fig.colorbar(cax, ticks=[-1, 0, 1])
    cbar = fig.colorbar(cax)
    #cbar.ax.set_yticklabels(['< -1', '0', '> 1'])  # vertically oriented colorbar
    pylab.savefig(savefile + ".png")
开发者ID:tomasalex,项目名称:aerosol,代码行数:26,代码来源:plots.py


示例7: __plot__

    def __plot__(self,fname):
        image_file = cbook.get_sample_data(fname)
        image = plt.imread(image_file)

        fig, ax1 = plt.subplots(1, 1)
        fig.set_size_inches(52,78)
        ax1.imshow(image)

        horiz_segments,vert_segments,horiz_intercepts,vert_intercepts = self.__get_grid_segments__()
        h_lines = self.__segments_to_grids__(horiz_segments,horiz_intercepts,horiz=True)
        v_lines = self.__segments_to_grids__(vert_segments,vert_intercepts,horiz=False)


        for (lb,ub) in h_lines:
            X,Y = zip(*lb)
            ax1.plot(X, Y,color="blue")
            X,Y = zip(*ub)
            ax1.plot(X, Y,color="blue")

        for (lb,ub) in v_lines:
            X,Y = zip(*lb)
            ax1.plot(X, Y,color="blue")
            X,Y = zip(*ub)
            ax1.plot(X, Y,color="blue")

        plt.savefig("/home/ggdhines/Databases/temp.jpg",bbox_inches='tight', pad_inches=0,dpi=72)
开发者ID:amyrebecca,项目名称:aggregation,代码行数:26,代码来源:backup_weather.py


示例8: use_image

 def use_image(self, axis, image_path):
     image_path = toolbox_basic.check_path(image_path)
     datafile = cbook.get_sample_data(image_path)
     image = Image.open(datafile)
     axis.set_ylim(0,image.size[0])
     axis.set_ylim(image.size[1],0)
     return imshow(image)
开发者ID:naqibahrahman,项目名称:iDynoMiCS,代码行数:7,代码来源:toolbox_plotting.py


示例9: test_equalize

def test_equalize(data):
    '''Test'''

    dfile = cbook.get_sample_data('s1045.ima', asfileobj=False)

    im = np.fromstring(file(dfile, 'rb').read(), np.uint16).astype(float)
    im.shape = 256, 256

    #imshow(im, ColormapJet(256))
    #imshow(im, cmap=cm.jet)
    
    imvals = np.sort(im.flatten())
    lo = imvals[0]
    hi = imvals[-1]
    steps = (imvals[::len(imvals)/256] - lo) / (hi - lo)
    num_steps = float(len(steps))
    interps = [(s, idx/num_steps, idx/num_steps) for idx, s in enumerate(steps)]
    interps.append((1, 1, 1))
    cdict = {'red' : interps,
             'green' : interps,
             'blue' : interps}
    histeq_cmap = colors.LinearSegmentedColormap('HistEq', cdict)
    pylab.figure()
    pylab.imshow(im, cmap=histeq_cmap)
    pylab.title('histeq')
    pylab.show()
开发者ID:calexyoung,项目名称:sunpy,代码行数:26,代码来源:cm.py


示例10: draw_map_image

def draw_map_image(x,y):
    f2,ax=plt.subplots()
    image_file = cbook.get_sample_data('/mnt/hgfs/I/ComputerVision/ISCAS/housemap001.jpg')
    img = plt.imread(image_file)
    #img = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
    #img=img[:,:,0]
    ax.set_xticks([])
    ax.set_yticks([])
    plt.title('emotion map')

    # Show the image
    plt.imshow(img)

    # matplotColors=['blue','green','red','cyan','magenta','yellow','black','white']
    colors = ['red', 'blue', 'yellow', 'green', 'cyan', 'black', 'magenta']
    assert len(colors) == emotions_num
    # Now, loop through coord arrays, and create a circle at each x,y pair
    for xx,yy in zip(x,y):
        emotion = np.random.choice(np.arange(emotions_num), p=[0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.4])
        p = Circle((xx, yy), 5, color=colors[emotion])
        ax.add_patch(p)

    # draw legend
    patches=[]
    for color,label in zip(colors,y_ticks):
        patch=Circle(color=color,label=label,xy=(5,5))
        patches.append(patch)

    plt.legend(handles=patches)

    #f2.draw
    #f2.canvas.draw()
    return f2
开发者ID:yzbx,项目名称:yzbxLib,代码行数:33,代码来源:demo_emotion_map.py


示例11: paste_image

def paste_image(filename):
    # annotate plot and paste image
    fig, ax = plt.subplots()

    xy = (0.5, 0.7)
    ax.plot(xy[0], xy[1], ".r")

    fn = get_sample_data(filename, asfileobj=False)
    arr_lena = read_png(fn)

    imagebox = OffsetImage(arr_lena, zoom=0.2)

    ab = AnnotationBbox(imagebox, xy,
                        xybox=(120., -80.),
                        xycoords='data',
                        boxcoords="offset points",
                        pad=0.5,
                        arrowprops=dict(arrowstyle="->", connectionstyle="angle,angleA=0,angleB=90,rad=3")
                        )

    ax.add_artist(ab)

    ax.set_xlim(0, 1)
    ax.set_ylim(0, 1)

    plt.draw()
    plt.show()
开发者ID:PierreExeter,项目名称:plot2d,代码行数:27,代码来源:function_lib.py


示例12: __init__

    def __init__(self, ax, n):
        self.ax = ax

        dir=os.path.abspath(os.path.dirname(sys.argv[0]))

        ax.axis([0,1,0,1])
        ax.axes.get_xaxis().set_visible(False)
        ax.axes.get_yaxis().set_visible(False)
        ax.set_frame_on=True

        ax.plot( [ 0.1, 0.2], [0.96, 0.96], color='blue',  linewidth=2 )
        ax.plot( [ 0.1, 0.2], [0.91, 0.91], color='green', linewidth=2 )
        ax.plot( [ 0.1, 0.2], [0.86, 0.86], color='red',   linewidth=1 )

        self.text1 = ax.text( 0.3, self.ypos(2), '%d' % n )

        fn = get_sample_data("%s/coolr-logo-poweredby-48.png" % dir, asfileobj=False)
        arr = read_png(fn)
        imagebox = OffsetImage(arr, zoom=0.4)
        ab = AnnotationBbox(imagebox, (0, 0),
                            xybox=(.75, .12),
                            xycoords='data',
                            boxcoords="axes fraction",
                            pad=0.5)
        ax.add_artist(ab)
开发者ID:coolr-hpc,项目名称:pycoolr,代码行数:25,代码来源:clr_matplot_graphs.py


示例13: show

def show(all_points_list):
    datafile = cbook.get_sample_data('C:/Dev/android/WifiRecord/app/src/main/res/drawable/greenstone_lower.png')
    lower_img = imread(datafile)
    lower_img_flip = lower_img[::-1, :, :]
    lower_img_faded = (255*0.7 + lower_img_flip*0.3).astype('uint8')
    datafile = cbook.get_sample_data('C:/Dev/android/WifiRecord/app/src/main/res/drawable/greenstone_upper.png')
    upper_img = imread(datafile)
    upper_img_flip = upper_img[::-1, :, :]
    upper_img_faded = (255*0.7 + upper_img_flip*0.3).astype('uint8')
    
    fig, (ax_upper, ax_lower) = plt.subplots(2, 1)
    #fig = fig = plt.gcf()
    #(ax_upper, ax_lower) = fig.axes
    #mng = plt.get_current_fig_manager()
    #mng.full_screen_toggle()
    
    
    
    for (i, points) in enumerate(zip(*all_points_list)):
        ax_upper.cla()
        ax_upper.imshow(upper_img_faded, zorder=0, extent=[0, 2200, 0, 1054])    
        ax_upper.set_xlim(400, 1800) 
        ax_upper.set_ylim(800, 300) 
        #ax_upper.set_xlim(1000, 1850) 
        #ax_upper.set_ylim(750, 450) 
        
        ax_lower.cla()
        ax_lower.imshow(lower_img_faded, zorder=0, extent=[0, 2200, 0, 760])
        ax_lower.axis([300, 1000, 100, 500])
        ax_lower.set_ylim(500, 100)
        colors = ("Black", "Red", "Blue", "Yellow")
        for (j, point) in enumerate(points):
            x = point["x"]
            y = point["y"]
            display = str(i) + "," + "{:.1f}".format(point["score"])
            if point["level"]==0:             
                ax_lower.plot([x], [y], 'o', color = colors[j])            
                ax_lower.text(x+1, y, display, fontsize=8)
            else:
                ax_upper.plot([x], [y], 'o', color = colors[j])            
                ax_upper.text(x+1, y, display, fontsize=8)
            
        
        plt.draw()
        time.sleep(0.1)
        
    plt.show()
开发者ID:JamesLTaylor,项目名称:wifi_ps,代码行数:47,代码来源:visualize_greenstone_path.py


示例14: main

def main():
    landmarks = ['American Museum of Natural History',
    'Brooklyn Bridge',
    'Central Park', 
    'Guggenheim Museum',
    'High Line',
    'Rockefeller Center',
    'September 11 Memorial',
    'Statue of Liberty',
    'Times Square',
    'Mystery']
    
    dist = distanceMatrix()
 

    adist = np.array(dist)
    amax = np.amax(dist)
    adist /= amax

    mds = manifold.MDS(n_components=2, dissimilarity="precomputed", random_state=6)
    results = mds.fit(dist)

    coords = results.embedding_
    print coords
    print coords[:,1][0]
    for x in range (len(coords[:,1])):
        coords[:,1][x] = coords[:,1][x]*-1
    #Can comment this out to run without background NYC MAP
    datafile = cbook.get_sample_data('/Users/niqson/5map.png')
    img = imread(datafile)
    plt.scatter(
    coords[:, 0], coords[:, 1], marker = 'o',s=25,color='cyan'
    )
    
    plt.annotate('Museum of Nat. History', coords[0])
    plt.annotate('Brooklyn Bridge', coords[1])
    plt.annotate('Central Park', coords[2],xytext = (-20, 20),textcoords = 'offset points', ha = 'right', va = 'bottom',
        bbox = dict(boxstyle = 'round,pad=0.2', fc = 'yellow', alpha = 0.5),
        arrowprops = dict(arrowstyle = '->', connectionstyle = 'arc3,rad=0'))
    plt.annotate('Guggenheim Museum', coords[3],xytext = (20, 10),textcoords = 'offset points', ha = 'right', va = 'bottom',
        bbox = dict(boxstyle = 'round,pad=0.2', fc = 'yellow', alpha = 0.5),
        arrowprops = dict(arrowstyle = '->', connectionstyle = 'arc3,rad=0'))
    plt.annotate('High Line', coords[4],xytext = (-20, 20),textcoords = 'offset points', ha = 'right', va = 'bottom',
        bbox = dict(boxstyle = 'round,pad=0.2', fc = 'yellow', alpha = 0.5),
        arrowprops = dict(arrowstyle = '->', connectionstyle = 'arc3,rad=0'))
    plt.annotate('Rockefeller Center', coords[5])
    plt.annotate('9/11 Memorial', coords[6])
    plt.annotate('Statue of Liberty', coords[7])
    plt.annotate('Times Square', coords[8],xytext = (-20, 20),textcoords = 'offset points', ha = 'right', va = 'bottom',
        bbox = dict(boxstyle = 'round,pad=0.2', fc = 'yellow', alpha = 0.5),
        arrowprops = dict(arrowstyle = '->', connectionstyle = 'arc3,rad=0'))
    plt.annotate('Mystery', coords[9],size = 20)
    rotated_img = scipy.ndimage.rotate(img, -10)
    plt.imshow(rotated_img, zorder=0, extent=[-32000, 30000, -30000, 19000])
    plt.show()
    
    '''
开发者ID:niqwilk,项目名称:Data-Science,代码行数:57,代码来源:Homework+12+Q1.py


示例15: logo_box

	def logo_box(self):
		
		logo_offset_image = OffsetImage(read_png(get_sample_data(logo_location, asfileobj=False)), zoom=0.25, resample=1, dpi_cor=1)
		text_box = TextArea(logo_text, textprops=dict(color='#444444', fontsize=50, weight='bold'))

		logo_and_text_box = HPacker(children=[logo_offset_image, text_box], align="center", pad=0, sep=25)

		anchored_box = AnchoredOffsetbox(loc=2, child=logo_and_text_box, pad=0.8, frameon=False, borderpad=0.)

		return anchored_box
开发者ID:tripatheea,项目名称:MODAnalyzer,代码行数:10,代码来源:MODPlot.py


示例16: test_colorbar_example1

def test_colorbar_example1():
    with cbook.get_sample_data('grace_hopper.png') as fp:
        data = np.array(plt.imread(fp))

    fig = plt.figure()
    ax = fig.add_subplot("111", aspect='equal')
    mappable = ax.imshow(data[..., 0], cmap='viridis')
    colorbar = Colorbar(mappable, location='lower left')
    colorbar.set_ticks([0.0, 0.5, 1.0])
    ax.add_artist(colorbar)
开发者ID:ppinard,项目名称:matplotlib-colorbar,代码行数:10,代码来源:test_colorbar.py


示例17: maritime_hall_figure

def maritime_hall_figure(fig_num, dem_file, reference_trajectory,
        slam_trajectory,
        mis_orient = quat.quaternion(np.array([1.0,0.0,0.0,0.0])),
        mis_position = [0.00, 0.00, 0.00]):

    import os
    from matplotlib.cbook import get_sample_data
    from matplotlib._png import read_png
    import matplotlib.image as image
    matplotlib.rcParams.update({'font.size': 15, 'font.weight': 'bold'})
    #fig = plt.figure(fig_num, figsize=(28, 16), dpi=120, facecolor='w', edgecolor='k')
    #ax = fig.add_subplot(111)
    fn = get_sample_data(os.getcwd()+"/data/img/maritime_hall.png", asfileobj=False)
    maritime_hall = image.imread(fn)
    fig, ax = plt.subplots()
    ax.imshow(maritime_hall, extent=[-1.2, 25, -2, 20])
    #ax.imshow(maritime_hall, extent=[-1.2, 25, -2, 19])

    # Display Ground Truth trajectory
    from numpy import linalg as la
    ref = np.column_stack((reference_trajectory[:,0][0::1], reference_trajectory[:,1][0::1], reference_trajectory[:,2][0::1]))
    ref[:] = [(mis_orient * i * mis_orient.conj())[1:4] for i in ref ]
    ref[:] = [ i + mis_position for i in ref ]
    x = ref[:,0]
    y = ref[:,1]
    ax.plot(x, y, marker='D', linestyle='-', lw=2, alpha=0.3, color=[1.0, 1.0, 0.0],
            label='ground truth', zorder=80)

    # Annotations
    from matplotlib.offsetbox import OffsetImage, AnnotationBbox

    ax.annotate(r'Start', xy=(x[0], y[0]), xycoords='data',
                            xytext=(-5, 5), textcoords='offset points', fontsize=16,
                            horizontalalignment='left',
                            verticalalignment='bottom',
                            zorder=101
                            )
    ax.scatter(x[0], y[0], marker='o', facecolor='k', s=40, alpha=1.0, zorder=103)

    ax.annotate(r'End', xy=(x[x.shape[0]-1], y[y.shape[0]-1]), xycoords='data',
                            xytext=(-5, 5), textcoords='offset points',
                            fontsize=16,
                            horizontalalignment='left',
                            verticalalignment='bottom',
                            zorder=101
                            )
    ax.scatter(x[x.shape[0]-1], y[y.shape[0]-1], marker='o', facecolor='k', s=40, alpha=1.0, zorder=103)


    plt.xlabel(r'X [$m$]', fontsize=15, fontweight='bold')
    plt.ylabel(r'Y [$m$]', fontsize=15, fontweight='bold')
    ax.legend(loc=1, prop={'size':15})
    plt.grid(True)
    fig.savefig("gt_maritime_hall_20180720-1644.png", dpi=fig.dpi)
    plt.show(block=True)
开发者ID:jhidalgocarrio,项目名称:processing_scripts,代码行数:55,代码来源:maritime_hall_shark_gt_20180720-1644.py


示例18: Date

def Date():
    #!/usr/bin/env python
    """
    Show how to make date plots in matplotlib using date tick locators and
    formatters.  See major_minor_demo1.py for more information on
    controlling major and minor ticks
    
    All matplotlib date plotting is done by converting date instances into
    days since the 0001-01-01 UTC.  The conversion, tick locating and
    formatting is done behind the scenes so this is most transparent to
    you.  The dates module provides several converter functions date2num
    and num2date
    
    """
    import datetime
    import numpy as np
    import matplotlib.pyplot as plt
    import matplotlib.dates as mdates
    import matplotlib.cbook as cbook
    
    years    = mdates.YearLocator()   # every year
    months   = mdates.MonthLocator()  # every month
    yearsFmt = mdates.DateFormatter('%Y')
    
    # load a numpy record array from yahoo csv data with fields date,
    # open, close, volume, adj_close from the mpl-data/example directory.
    # The record array stores python datetime.date as an object array in
    # the date column
    datafile = cbook.get_sample_data('goog.npy')
    r = np.load(datafile).view(np.recarray)
    
    fig, ax = plt.subplots()
    ax.plot(r.date, r.adj_close)
    
    
    # format the ticks
    ax.xaxis.set_major_locator(years)
    ax.xaxis.set_major_formatter(yearsFmt)
    ax.xaxis.set_minor_locator(months)
    
    datemin = datetime.date(r.date.min().year, 1, 1)
    datemax = datetime.date(r.date.max().year+1, 1, 1)
    ax.set_xlim(datemin, datemax)
    
    # format the coords message box
    def price(x): return '$%1.2f'%x
    ax.format_xdata = mdates.DateFormatter('%Y-%m-%d')
    ax.format_ydata = price
    ax.grid(True)
    
    # rotates and right aligns the x labels, and moves the bottom of the
    # axes up to make room for them
    fig.autofmt_xdate()

    plt.show()
开发者ID:luwy007,项目名称:MatPlotLib,代码行数:55,代码来源:MatPlotLib.py


示例19: display_wordcloud

def display_wordcloud(words, counts):
    with tempfile.NamedTemporaryFile(suffix='.png') as tmp:
        temp_filename = tmp.name
        counts = wordcloud.make_wordcloud(words, counts, temp_filename, font_path='/Library/Fonts/Georgia.ttf',width=800, height=800, ranks_only=False)
        image_file = cbook.get_sample_data(temp_filename)
        image = plt.imread(image_file)

        fig, ax = plt.subplots()
        im = ax.imshow(image)
        plt.axis('off')
        plt.show()
开发者ID:williamsdoug,项目名称:NLTK_Experiments,代码行数:11,代码来源:my_word_cloud.py


示例20: openImage

    def openImage(self) :
        texto = 'Escolha uma imagem'
        path = QtGui.QFileDialog.getOpenFileNameAndFilter(self,
                                                          texto,
                                                          self.thisDir,
                                                          "Images (*.png *.jpg)")
                                                    
        datafile = cbook.get_sample_data(str(path[0]))
        img = imread(datafile)

        self.updateCanvas(self.initializeCanvas(img))

        return
开发者ID:alexandrecmaciel,项目名称:Interfaces-graficas-Python-Qt,代码行数:13,代码来源:versao003+(shared+ver.).py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python cbook.is_numlike函数代码示例发布时间:2022-05-27
下一篇:
Python cbook.flatten函数代码示例发布时间: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