当前位置: 首页 > news >正文

网络服务器的作用/seo推广效果怎么样

网络服务器的作用,seo推广效果怎么样,网络工程有哪些,网站上怎么做动图实际上不容易从绘图中删除颜色条,然后再绘制一个新颜色. 我现在能想出的最佳解决方案如下,假设图中只有一个轴.现在,如果有第二个轴,它必须是存在的颜色条.因此,通过检查我们在图上找到多少轴,我们可以判断是否存在颜色条. 在这里,我们还要注意用户不希望从外部引用任何命名对象…

实际上不容易从绘图中删除颜色条,然后再绘制一个新颜色.

我现在能想出的最佳解决方案如下,假设图中只有一个轴.现在,如果有第二个轴,它必须是存在的颜色条.因此,通过检查我们在图上找到多少轴,我们可以判断是否存在颜色条.

在这里,我们还要注意用户不希望从外部引用任何命名对象. (这没有多大意义,因为我们无论如何都需要使用plt,但是嘿..问题也是如此)

import matplotlib.pyplot as plt

import numpy as np

fig,ax = plt.subplots()

im = ax.pcolormesh(np.array(np.random.rand(2,2) ))

ax.plot(np.cos(np.linspace(0.2,1.8))+0.9,np.sin(np.linspace(0.2,c="k",lw=6)

ax.set_title("Title")

cbar = plt.colorbar(im)

cbar.ax.set_ylabel("Label")

for i in range(10):

# inside this loop we should not access any variables defined outside

# why? no real reason,but questioner asked for it.

#draw new colormesh

im = plt.gcf().gca().pcolormesh(np.random.rand(2,2))

#check if there is more than one axes

if len(plt.gcf().axes) > 1:

# if so,then the last axes must be the colorbar.

# we get its extent

pts = plt.gcf().axes[-1].get_position().get_points()

# and its label

label = plt.gcf().axes[-1].get_ylabel()

# and then remove the axes

plt.gcf().axes[-1].remove()

# then we draw a new axes a the extents of the old one

cax= plt.gcf().add_axes([pts[0][0],pts[0][1],pts[1][0]-pts[0][0],pts[1][1]-pts[0][1] ])

# and add a colorbar to it

cbar = plt.colorbar(im,cax=cax)

cbar.ax.set_ylabel(label)

# unfortunately the aspect is different between the initial call to colorbar

# without cax argument. Try to reset it (but still it's somehow different)

cbar.ax.set_aspect(20)

else:

plt.colorbar(im)

plt.show()

通常,更好的解决方案是对绘图中已存在的对象进行操作,并仅使用新数据更新它们.因此,我们无需移除和添加轴,并找到更清洁,更快速的解决方案.

import matplotlib.pyplot as plt

import numpy as np

fig,lw=6)

ax.set_title("Title")

cbar = plt.colorbar(im)

cbar.ax.set_ylabel("Label")

for i in range(10):

data = np.array(np.random.rand(2,2) )

im.set_array(data.flatten())

cbar.set_clim(vmin=data.min(),vmax=data.max())

cbar.draw_all()

plt.draw()

plt.show()

更新:

实际上,后一种从外部引用对象的方法甚至与提问者所希望的多进程方法一起工作.

所以,这是一个更新图形的代码,无需删除颜色条.

import matplotlib.pyplot as plt

import numpy as np

import multiprocessing

import time

fig,c="w",lw=6)

ax.set_title("Title")

cbar = plt.colorbar(im)

cbar.ax.set_ylabel("Label")

tx = ax.text(0.2,0.8,"",fontsize=30,color="w")

tx2 = ax.text(0.2,0.2,color="w")

def do(number):

start = time.time()

tx.set_text(str(number))

data = np.array(np.random.rand(2,2)*(number+1) )

im.set_array(data.flatten())

cbar.set_clim(vmin=data.min(),vmax=data.max())

tx2.set_text("{m:.2f} < {ma:.2f}".format(m=data.min(),ma= data.max() ))

cbar.draw_all()

plt.draw()

plt.savefig("multiproc/{n}.png".format(n=number))

stop = time.time()

return np.array([number,start,stop])

if __name__ == "__main__":

multiprocessing.freeze_support()

some_list = range(0,50)

num_proc = 5

p = multiprocessing.Pool(num_proc)

nu = p.map(do,some_list)

nu = np.array(nu)

plt.close("all")

fig,ax = plt.subplots(figsize=(16,9))

ax.barh(nu[:,0],nu[:,2]-nu[:,1],height=np.ones(len(some_list)),left=nu[:,align="center")

plt.show()

(最后的代码显示了一个时间表,可以看到确实发生了多处理)

http://www.lbrq.cn/news/785701.html

相关文章:

  • 企业网站建设平台/成品网站源码1688免费推荐
  • 怎样才能增加网站/网络平台推广方式
  • 深圳工程造价建设信息网站/网站设计公司哪家专业
  • 企业集团网站建设与运营/泰州百度seo公司
  • jquery mobile网站模板/微信群拉人的营销方法
  • 中企动力科技股份有限公司广州分公司/网站seo完整seo优化方案
  • 中学教材数字化学习资源的建设——教材配套网站的设计及发展趋势/常德政府网站
  • 乐清英文网站建设/甘肃搜索引擎网络优化
  • 新网备案成功了怎么做网站/2024年最新时事新闻
  • 买虚机送网站建设/网页制作官方网站
  • wordpress get permalink/seo独立站优化
  • 建筑设计和室内设计哪个好/关键词优化
  • 企业网站备案资料/常州seo博客
  • 杨浦做网站公司/搜索引擎推广的费用
  • 本人做静态网站开发/网页制作公司排名
  • 找别人做网站怎么防止别人修改/个人代运营一般怎么收费
  • 零基础编程学python/seo下载站
  • 莱芜益寿堂网站/零基础学seo要多久
  • 随州建设网站/公司网站搭建流程
  • 网站开发翻译插件/百度指数官网登录
  • 十大网站有哪些/广告门
  • 网页设计网站建设的基本流程/seo怎么学
  • 牡丹江网站建设定制开发/搜索引擎优化的方法有哪些?
  • 学生个人网站模板/百度ai入口
  • 免费logo设计网站推荐/谷歌搜索入口 镜像
  • 江苏设计网站电话/旅游网络营销的渠道有哪些
  • 四川省建设监理协会网站/磁力多多
  • php网站文件夹恶意复制 空间占满/营销型网站建设运营
  • WordPress做漫画网站/其他搜索引擎
  • 网站漏洞怎么修复/又有什么新病毒出现了
  • 前端实现Excel文件的在线预览效果
  • Druid学习笔记 01、快速了解Druid中SqlParser实现
  • C++高频知识点(十四)
  • 国产化Word处理控件Spire.Doc教程:Python提取Word文档中的文本、图片、表格等
  • day38 力扣279.完全平方数 力扣322. 零钱兑换 力扣139.单词拆分
  • 应用药品注册证识别技术,为医药行业的合规、高效与创新发展提供核心驱动力