当前位置: 首页>>代码示例>>Python>>正文


Python Basemap._check_ax方法代码示例

本文整理汇总了Python中mpl_toolkits.basemap.Basemap._check_ax方法的典型用法代码示例。如果您正苦于以下问题:Python Basemap._check_ax方法的具体用法?Python Basemap._check_ax怎么用?Python Basemap._check_ax使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mpl_toolkits.basemap.Basemap的用法示例。


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

示例1: Stereo

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import _check_ax [as 别名]
class Stereo(base.Generic):
    #_required = ['anisotropy']

    def initialize_visual(self):
        super(Stereo, self).initialize_visual()
        #self._required = RockPy.Measurements.anisotropy.Anisotropy
        # create instance of basemap with south polar projection to 90 = E
        self.stereomap = Basemap(projection='spstere', boundinglat=0, lon_0=180, resolution='l', round=True, suppress_ticks=True, rsphere=1)
        self.grid_D_spacing = 30
        self.grid_I_spacing = 15
        self.standard_features = []
        self.single_features = [self.feature_stereogrid, self.feature_stereogridlabels]
        self.add_plot()
        self.ax = self.figs[self.name][0].gca()
        self.xlabel = ''
        self.ylabel = ''

    ''' Features '''

    def feature_stereogrid(self, **plt_opt):
        # set the grid up
        Grid_D = np.arange(-180.0, 180.0, self.grid_D_spacing)
        Grid_I = np.arange(-90.0, 0.0, self.grid_I_spacing)

        # draw parallel and meridian grid, labels are off.
        self.stereomap.drawmeridians(Grid_D)
        self.stereomap.drawparallels(Grid_I, latmax=90)

    def feature_stereogridlabels(self, **plt_opt):
        # draw declination labels
        for D in np.arange(0, 360, self.grid_D_spacing):
            x = (0.55*np.sin(np.deg2rad(D)))+0.5
            y = (0.55*np.cos(np.deg2rad(D)))+0.5
            self.ax.text(x, y, "%i" % D, transform=self.ax.transAxes,
                         horizontalalignment='center', verticalalignment='center')

        # draw inclination labels
        for I in np.arange(self.grid_I_spacing, 90, self.grid_I_spacing):
            (x, y) = self.stereomap(0, -I)
            self.ax.text(x-0.1, y-0.07, "%i" % I, horizontalalignment='center', verticalalignment='center')


    def feature_points(self, m_obj, **plt_opt):
        d, i = (30, 50, 120, 150), (-10, -20, -30, -40)
        lines = self.ax.plot(*self.stereomap(d, i), **plt_opt)
        self._add_line_text_dict(m_obj.sample_obj.name, '_'.join(m_obj.stypes), '_'.join(map(str, m_obj.svals)), lines)


    def show(self):
        self.stereomap._check_ax().set_xlim((0.5, -4.5))  # reduce size of plot to make space for labels
        self.stereomap._check_ax().set_ylim((0.5, -4.5))  # reduce size of plot to make space for labels
        super(Stereo, self).show()
开发者ID:RiccardaNaeve,项目名称:RockPy,代码行数:54,代码来源:stereo.py

示例2: top_pokemon_by_loc

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import _check_ax [as 别名]
            'magnemite', 'magneton', "farfetch'd", 'doduo', 'dodrio', 'seel',
            'grimer', 'muk', 'shellder', 'cloyster', 'gastly', 'haunter',
            'gengar', 'onix', 'drowzee', 'hypno', 'krabby', 'kingler',
            'voltorb', 'electrode', 'exeggcute', 'exeggutor', 'cubone',
            'marowak', 'hitmonlee', 'hitmonchan', 'lickitung', 'koffing',
            'weezing', 'rhyhorn', 'rhydon', 'chansey', 'tangela', 'kangaskhan',
            'horsea', 'seadra', 'goldeen', 'seaking', 'staryu', 'starmie',
            'mr. mime', 'scyther', 'jynx', 'electabuzz', 'magmar', 'pinsir',
            'tauros', 'magikarp', 'gyarados', 'lapras', 'ditto', 'eevee', 
            'vaporeon', 'jolteon', 'flareon', 'porygon', 'omanyte', 'omastar',
            'kabuto', 'kabutops', 'aerodactyl', 'snorlax', 'articuno', 'zapdos',
            'moltres', 'dratini', 'dragonair', 'dragonite', 'mewtwo', 'mew']

state_loc_list = [(k, v[0], v[1], state_sum_dict[k], top_pokemon_by_loc(k, state_len_dict, 1, e_p)[0][0]) for k, v in state_loc_dict.iteritems()]
state_loc_zip = zip(*state_loc_list)
state_names = state_loc_zip[0]
state_longs = state_loc_zip[1]
state_lats = state_loc_zip[2]
state_sums = state_loc_zip[3]
state_pokemons = state_loc_zip[4]

for lon, lat, n_sum, pokemon in zip(state_longs, state_lats, state_sums, state_pokemons):
	if n_sum > 0 and pokemon != None:
		x, y = my_map(lon, lat)
		ab = place_poke_img(x, y, pokemon)
		my_map._check_ax().add_artist(ab)

plt.title('Most popular starter pokemon for continental U.S. states')

#plt.show()
plt.savefig('starters_by_state.png', dpi=300, frameon=False, format="png", facecolor='white')
开发者ID:JuliaWinchester,项目名称:pokedata,代码行数:33,代码来源:plot_pokemon_map_states.py


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