前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >python潜规则?居然有隐藏参数?---其实是继承的关系~

python潜规则?居然有隐藏参数?---其实是继承的关系~

作者头像
一个有趣的灵魂W
发布2020-09-15 12:19:52
4700
发布2020-09-15 12:19:52
举报
文章被收录于专栏:一个有趣的灵魂W

from osgeo import gdal

d=gdal.Open(r'D:\idl\visible temp\c20180106_00.tif')

bandg = d.GetRasterBand(1)

elevationg = bandg.ReadAsArray()

x0, dx, dxdy, y0, dydx, dy = d.GetGeoTransform()

nrows, ncols = elevationg.shape#竖57横52

x1 = x0 + dx * ncols

y1 = y0 + dy * nrows

latst=np.linspace(x0,x1,ncols)

lonst=np.linspace(y0,y1,nrows)

lont, latt = np.meshgrid(latst, lonst)

lon_0t=(x0+x1)/2#计算中心坐标

lat_0t=(y0+y1)/2#计算中心坐标

#m = Basemap(lat_0=lat_0t, lon_0=lon_0t)

map = Basemap(projection = 'cyl',lat_0 = lat_0t, lon_0 = lon_0t,llcrnrlon = x0, llcrnrlat = y1,

urcrnrlon = x1,urcrnrlat = y0,resolution = 'c')#设置显示范围

map.readshapefile('D:\idl\Export_Output3','a')#输入显示矢量文件

#clevs = [0,1,2.5,5,7.5,10,15,20,30,40,50,70,100,150,200,250,300,400,500,600,750]

xit, yit = map(lont, latt)#

#cs = map.contourf(xit,yit,elevationg,clevs,cmap=cm.s3pcpn)

levels=map.pcolor(xit,yit,elevationg)#显示图像

map.drawparallels(np.arange(24, 25, 0.15), labels=[True,False,False,True],fontsize=10, rotation=90)#纬度大小

map.drawmeridians(np.arange(117, 119, 0.15), labels=[True,False,False,True],fontsize=10)#经度大小

cbar = map.colorbar(levels, location='right', pad="2%")

这是一个隐藏参数。。。我天用户手册没有这个参数好么!!

附用户手册:

https://matplotlib.org/basemap/api/basemap_api.html#mpl_toolkits.basemap.Basemap.drawparallels

drawparallels(circles, color='k', textcolor='k', linewidth=1.0, zorder=None, dashes=[1, 1], labels=[0, 0, 0, 0], labelstyle=None, fmt='%g', xoffset=None, yoffset=None, ax=None, latmax=None, **text_kwargs)

Draw and label parallels (latitude lines) for values (in degrees) given in the sequence circles.

Keyword

Description

color

color to draw parallels (default black).

textcolor

color to draw labels (default black).

linewidth

line width for parallels (default 1.)

zorder

sets the zorder for parallels (if not specified, uses default zorder for matplotlib.lines.Line2D objects).

dashes

dash pattern for parallels (default [1,1], i.e. 1 pixel on, 1 pixel off).

labels

list of 4 values (default [0,0,0,0]) that control whether parallels are labelled where they intersect the left, right, top or bottom of the plot. For example labels=[1,0,0,1] will cause parallels to be labelled where they intersect the left and and bottom of the plot, but not the right and top.

labelstyle

if set to “+/-”, north and south latitudes are labelled with “+” and “-”, otherwise they are labelled with “N” and “S”.

fmt

a format string to format the parallel labels (default ‘%g’) or a function that takes a latitude value in degrees as it’s only argument and returns a formatted string.

xoffset

label offset from edge of map in x-direction (default is 0.01 times width of map in map projection coordinates).

yoffset

label offset from edge of map in y-direction (default is 0.01 times height of map in map projection coordinates).

ax

axes instance (overrides default axes instance)

latmax

absolute value of latitude to which meridians are drawn (default is 80).

**text_kwargs

additional keyword arguments controlling text for labels that are passed on to the text method of the axes instance (see matplotlib.pyplot.text documentation).

returns a dictionary whose keys are the parallel values, and whose values are tuples containing lists of the matplotlib.lines.Line2D and matplotlib.text.Text instances associated with each parallel. Deleting an item from the dictionary removes the corresponding parallel from the plot.

手册里没有rotation这个参数好么,其实是继承的关系,手册没有这个参数也可以试试。。。具体什么是继承,百度吧

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2019-05-29,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 一个有趣的灵魂W 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档