- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试在等高线图上添加阴影线(如点、散列、..)。这样的影线可以代表唯一具有统计显着性的轮廓,或具有特定标准的轮廓。喜欢下图自然文章(第二和第三情节)http://www.nature.com/articles/srep16853/figures/3 .
以下代码显示来自 NOAA 数据的降水图 available下载地址:
import numpy as np
import sys
import netCDF4 as nc
import matplotlib.pyplot as plt
import matplotlib.mlab as m
import mpl_toolkits.basemap as bm
import os
sys.path.insert(0, '../');import py4met as sm;reload(sm)
#- Reading data for a timeslice, latitude, and longitude:
diri_output="./"
diri="./"
tmp_file = nc.Dataset(diri+"precip.mon.mean.nc","r")
print(tmp_file.variables)
p_pre = tmp_file.variables['precip']
lat = tmp_file.variables['lat'][:]
lon = tmp_file.variables['lon'][:]
time = tmp_file.variables['time']
tmp_file.close
lat1=np.min(lat)
lat2=np.max(lat)
lon1=np.min(lon)
lon2=np.max(lon)
[lonall, latall] = np.meshgrid(lon[:], lat[:])
plt.figure(num=None, figsize=(8+4, 6+4), dpi=80, facecolor='w', edgecolor='k')
mapproj = bm.Basemap(projection='cyl',llcrnrlat=lat1, llcrnrlon=lon1,urcrnrlat=lat2, urcrnrlon=lon2,resolution='l')
mapproj.drawcoastlines()
mapproj.drawmapboundary(fill_color='white')
mapproj.drawcountries()
x, y = mapproj(lonall, latall)
plt.contourf(x,y,p_pre[240,:,:],cmap=plt.cm.GnBu)
plt.colorbar(orientation='horizontal',pad=0.05,shrink=0.6)
plt.title("title")
xx,yy=np.where(p_pre[240,:,:] >= 20)
sig=np.copy(p_pre[0,:,:])
sig[:,:]=1
sig[xx,yy]=0
#plt.contourf(x,y,sig,hatches=['.'])
plt.show()
我想对20mm以上的所有轮廓进行孵化,所以用了上面的命令
plt.contourf(x,y,sig,hatches=['.'])
但它没有用(它在 map 上到处都是点,而不仅仅是具有特定标准的轮廓),因此我评论了它。任何想法。
最佳答案
查看此 matplotlib example page演示如何使用 contourf
使用影线。与您的问题特别相关的是 (1) contourf
采用关键字 level
来确定哪些值被着色和/或影线的界限,并且( 2) 空字符串 ""
可用于缺少舱口。
因此,您注释掉的不是 plt.contourf
行
levels = [p_pre[240,:,:].min(), 20, p_pre[240,:,:].max()]
plt.contourf(x, y, p_pre[240,:,:], levels=levels, hatches=["", "."], alpha=0)
我无法根据您链接到的数据重新创建您的绘图,因此我生成了一些随机数据,使用我上面描述的相同原理制作下面的图像。
关于python - 覆盖代表等高线图上重要点的补丁,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36721977/
什么是事物 事务是一种机制、一个操作序列,包含了一组数据库操作命令,并且把所有的命令作为一个整体一起向系统提交或撤销操作请求,即这组数据库命令要么都执行,要么都不执行。 事务是一个不可分割的工.作逻辑
什么是范式? 简言之就是,数据库设计对数据的存储性能,还有开发人员对数据的操作都有莫大的关系。所以建立科学的,规范的数据库是需要满足一些规范来优化数据数据存储方式。在关系型数据库中这些规范就可以称为范
什么是事物 事务是一种机制、一个操作序列,包含了一组数据库操作命令,并且把所有的命令作为一个整体一起向系统提交或撤销操作请求,即这组数据库命令要么都执行,要么都不执行。 事务是一个不可分割的工.作逻辑
什么是范式? 简言之就是,数据库设计对数据的存储性能,还有开发人员对数据的操作都有莫大的关系。所以建立科学的,规范的数据库是需要满足一些规范来优化数据数据存储方式。在关系型数据库中这些规范就可以称为范
我正在尝试修改网站的布局,但有时网站会使用 !important,有没有办法覆盖它?我似乎无法弄清楚如何在页面的 css 文件之后加载 css 内容脚本。 最佳答案 !important CSS 规则
这个问题在这里已经有了答案: How to override !important? (12 个答案) 关闭 9 年前。 我写了一些 html,并在第三方网站中注入(inject)了一些 css 样
好的,我在这里安装了一个 wordpress 主题(www.sullivansuccesscoaching.com/home ...我们需要/home,因为仍然有一个 index.html 隐藏了 w
我已经为我的 Wordpress 模板创建了一个覆盖原始 CSS 的自定义样式表。但是,在我的日历页面上,原始 CSS 具有使用 !important 声明设置的每个表格单元格的高度: td {hei
这个问题在这里已经有了答案: How to document deconstructed parameters with JsDoc (1 个回答) 关闭 5 年前。 我正在努力寻找对文档 ES6
我的网站使用 bootstrap 4 和我制作的 css 文件。 在这个 css 文件的底部,我放置了一些媒体查询: @media (max-width: 575px) { .address .c
可以将 background-position X 设置为 0 带有标志 !important 和背景位置 Y 不带 !important? 例如: background-position-x: 0
我只想在焦点状态下去掉下拉列表中的轮廓。看这张图 我尝试使用 !important 覆盖 Bootstrap ,但根本不起作用。只是检查开发工具,突然看到这个。 Bootstrap 也使用 !impo
这个问题在这里已经有了答案: How to override !important? (12 个答案) 关闭 1 年前。
发生了什么事?:我的 jQuery Accordion 的动画坏了。在关闭上一个选项卡之前短时间单击下一个选项卡后,它会显示之前打开的选项卡。动画也不滑动。 CSS:来自this answer /*
如何使用 javascript 或 CSS 覆盖样式“color: red”?我想让它成为“2px”而不是“1px”边框。 Lorem... 我无法向“div”添加类、id。这不
这个问题在这里已经有了答案: How to override !important? (12 个答案) 关闭 5 年前。
滚动有问题不想显示其内容,如果我这样做 #callCenter { position: fixed; z-index: 2411 !important; display: bl
序言 1、MySQL表操作(创建表,查询表结构,更改表字段等), 2、MySQL的数据类型(CHAR、VARCHAR、BLOB,等), 本节比较重要,对数据表数据进行查询操作,其中可能大
如何将!important添加到客户端包GWT中的gwt-image: 我有这个: @sprite .superButton{ gwt-image : 'superButton'; backg
请帮助我..我想验证表单并使用 ajax 发送。 验证没有 ''onsubmit="return validateForm(this);"'' 工作。 但是当表单正确时,它的发送表单(页面刷新..)请
我是一名优秀的程序员,十分优秀!