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

南阳高质量建设大城市网站百度浏览器网址是多少

南阳高质量建设大城市网站,百度浏览器网址是多少,火车头wordpress4.9,广东建设厅证件查询网站前言 Matplotlib画图工具的官网地址是 http://matplotlib.org/ Python环境下实现Matlab制图功能的第三方库,需要numpy库的支持,支持用户方便设计出二维、三维数据的图形显示,制作的图形达到出版级的标准。 其他matplotlib文章 python--matpl…

前言 

Matplotlib画图工具的官网地址是 http://matplotlib.org/

Python环境下实现Matlab制图功能的第三方库,需要numpy库的支持,支持用户方便设计出二维、三维数据的图形显示,制作的图形达到出版级的标准。

其他matplotlib文章

python--matplotlib(1)_码银的博客-CSDN博客

python--matplotlib(2)_码银的博客-CSDN博客

python--matplotlib(3)_码银的博客-CSDN博客

实验环境

Pycharm2020.2.5社区版,win11 

正文 

三维立体图形:

除了要引用matplotlib外,还需要引用mpl_toolkits.mplot3d库(from mpl_toolkits.mplot3d import Axes3D),需要在matplotlib的figure函数生成实例对象后(fig = plt.figure()),设置其制图模式为3d(fig.add_subplot(111, projection='3d'))。

1.简单三维图

import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
sd = fig.add_subplot(111, projection='3d')#111,221,222,223,224
plt.show()

fc71951f8e8d4c5ba27dcb1cfcdf948c.png

import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
sd = fig.add_subplot(111, projection='3d')#111,221,222,223,224
X = [0, 1, 2, 1, 2, 4]
Y = [0, 4, 4, 1, 3, 4]
Z = [0, 4, 0, 0, 2, 4]
sd.plot_trisurf(X, Y, Z)
plt.show()

e06d235f9f364e9fb7ee7144e26336eb.png 

 

这个3d图可以转动,方便观察;

第四行代码:111,就是全屏或者或是正中间,剩下(221、222、223、224)对应四个角落,下面我依次截图看一下:

df0ab86fe68848d5b35cdd3f1772c6f0.png6a1231940bba4e499d62e1daf267fdfb.png

b77f3348d7dd4370b1e1be991fea5eb0.pngf76cfbb17b84473b958ae48e206a6ae4.png

plot_trisurf(z,y,z,...) :画3d曲平面的函数。

x,y,z要竖着看,一列对应的是一个点的坐标。

2.三维曲面plot_trisurf(薯片)

import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3Dradius = np.linspace(0.1, 1, 25)
#np.linspace(start = 0.1, stop = 1, num = 25)
#stop 参数数值范围的终止点。通常其为结果的最后一个值,但如果修改endpoint = False, 则结果中不包括该值
angle = np.linspace(0, 2 * np.pi, 60, endpoint=False)
angle = np.repeat(angle[..., np.newaxis],25, axis=0)
#angles[..., np.newaxis]将每个元素转化为列表,np.repeat(a,repeats,axis=None);
# repeats:复制次数;axis=None,flatten当前矩阵,axis=0,增加行数,列数不变,axis=1,增加列数,行数不变
x = np.append(1, (radius * np.cos(angle)).flatten())
y = np.append(0, (radius * np.sin(angle)).flatten())
#flatten()是对多维数据的降维函数
y=y/2
x=x/2
z = np.sin(x * y)
z=z/2
fig = plt.figure()
sd = fig.add_subplot(projection='3d')
sd.plot_trisurf(x, y, z, cmap=plt.get_cmap('YlOrRd'), linewidth=0.1)
plt.show()

06c6b554141f44dea159619dbb2d2413.png

 a.导入库

import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D

b.数据准备

radius = np.linspace(0.1, 1, 25)
angle = np.linspace(0, 2 * np.pi, 60, endpoint=False)
angle = np.repeat(angle[..., np.newaxis],25, axis=0)
x = np.append(1, (radius * np.cos(angle)).flatten())
y = np.append(0, (radius * np.sin(angle)).flatten())
y=y/2
x=x/2
z = np.sin(x * y)
z=z/2

linspace()函数

np.linspace(start = 0.1, stop = 1, num = 25)

start 参数数值范围的起始点。

stop 参数数值范围的终止点。通常其为结果的最后一个值,但如果修改endpoint = False, 则结果中不包括该值

num:数据数量,本篇选择了25个。

 

flatten()函数是对多维数据的降维函数,将矩阵的行之间首尾连接,组成一个一维矩阵;

 

repeat()函数

np.repeat(a,repeats,axis=0)

repeats:复制次数;

axis=None,把矩阵变成了一个一维矩阵[1,2,3,4];

axis=0,增加行数,列数不变;

axis=1,增加列数,行数不变

angles[..., np.newaxis]将每个元素转化为列表,

c.画图

fig = plt.figure()
sd = fig.add_subplot(projection='3d')
sd.plot_trisurf(x, y, z, cmap=plt.get_cmap('YlOrRd'), linewidth=0.1)
plt.show()

cmap:调换颜色的作用

linewidth:线宽

3.三维曲面标题等设置

import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
plt.rcParams["font.sans-serif"] = ["SimHei"]# 正确显示中文和负号
plt.rcParams["axes.unicode_minus"] = False
fig = plt.figure()
sd = fig.add_subplot(111, projection='3d')#111,221,222,223,224
X = [0, 1, 2, 1, 2, 4]
Y = [0, 4, 4, 1, 3, 4]
Z = [0, 4, 0, 0, 2, 4]
sd.set_xlabel('x轴')
sd.set_ylabel('y轴')
sd.set_zlabel('z轴')
plt.title('这是标题')
sd.plot_trisurf(X, Y, Z)
plt.show()

1176c0f00b4641938d1b4703e965efe8.png

我就直接使用标题1里面的代码加工了,

sd.set_xlabel('x轴')#x轴函数

sd.set_ylabel('y轴')#y轴函数

sd.set_zlabel('z轴')#z轴函数

plt.title('这是标题')#添加标题函数

因为我使用了中文,

plt.rcParams["font.sans-serif"] = ["SimHei"]# 正确显示中文和负号
plt.rcParams["axes.unicode_minus"] = False

所以还得用这两行代码,要是仅仅使用英文的话删除即可。

4.小结 

当初我第一次numpy库的时候的心得:使用pip install matplotlib安装matplotlib库,而 numpy 库我是在c:\users\yonghuming\appdata\local\programs\python\python39\scripts的目录下使用pip install numpy-1.22.4-cp39-cp39-win_amd64.whl才安装成功的。

现在我使用的是anaconda,直接把大部分的库安装好了,省时省力。

 


文章转载自:
http://paisana.hmxb.cn
http://dyad.hmxb.cn
http://unmixable.hmxb.cn
http://wizardly.hmxb.cn
http://photodegradable.hmxb.cn
http://diffuser.hmxb.cn
http://riverlet.hmxb.cn
http://octameter.hmxb.cn
http://lithotome.hmxb.cn
http://statued.hmxb.cn
http://vindicable.hmxb.cn
http://hopscotch.hmxb.cn
http://enophthalmus.hmxb.cn
http://gunslinging.hmxb.cn
http://underprize.hmxb.cn
http://vedalia.hmxb.cn
http://castock.hmxb.cn
http://inexistence.hmxb.cn
http://bierstube.hmxb.cn
http://overfeeding.hmxb.cn
http://impala.hmxb.cn
http://eunomy.hmxb.cn
http://djokjakarta.hmxb.cn
http://sepsis.hmxb.cn
http://radiotelegraphic.hmxb.cn
http://theodicean.hmxb.cn
http://bounty.hmxb.cn
http://lytta.hmxb.cn
http://moneylender.hmxb.cn
http://enhalo.hmxb.cn
http://avi.hmxb.cn
http://exotericist.hmxb.cn
http://heteromorphosis.hmxb.cn
http://small.hmxb.cn
http://legitimatize.hmxb.cn
http://mangily.hmxb.cn
http://pledget.hmxb.cn
http://hypothecate.hmxb.cn
http://retinotectal.hmxb.cn
http://psychotherapist.hmxb.cn
http://acrid.hmxb.cn
http://egyptianize.hmxb.cn
http://bellflower.hmxb.cn
http://vexillar.hmxb.cn
http://emanuel.hmxb.cn
http://appeasement.hmxb.cn
http://conference.hmxb.cn
http://sidespin.hmxb.cn
http://radicidation.hmxb.cn
http://newsman.hmxb.cn
http://corral.hmxb.cn
http://fortaleza.hmxb.cn
http://paleontology.hmxb.cn
http://twice.hmxb.cn
http://bulky.hmxb.cn
http://sporadically.hmxb.cn
http://ninth.hmxb.cn
http://candlestick.hmxb.cn
http://pullout.hmxb.cn
http://nonarticulate.hmxb.cn
http://cycloheximide.hmxb.cn
http://pid.hmxb.cn
http://unwit.hmxb.cn
http://surrebuttal.hmxb.cn
http://chronicity.hmxb.cn
http://currawong.hmxb.cn
http://snowfall.hmxb.cn
http://baubee.hmxb.cn
http://coral.hmxb.cn
http://calamus.hmxb.cn
http://impregnatable.hmxb.cn
http://jiujitsu.hmxb.cn
http://allimportant.hmxb.cn
http://copal.hmxb.cn
http://geopolitist.hmxb.cn
http://remex.hmxb.cn
http://advocator.hmxb.cn
http://syngarny.hmxb.cn
http://compassable.hmxb.cn
http://scamping.hmxb.cn
http://whiffet.hmxb.cn
http://wolverhampton.hmxb.cn
http://gurglet.hmxb.cn
http://flannel.hmxb.cn
http://uncomfortably.hmxb.cn
http://formicate.hmxb.cn
http://hymenopter.hmxb.cn
http://nucleocosmochronology.hmxb.cn
http://revolver.hmxb.cn
http://omophagia.hmxb.cn
http://micrometry.hmxb.cn
http://snift.hmxb.cn
http://deuterate.hmxb.cn
http://burundi.hmxb.cn
http://rim.hmxb.cn
http://woefully.hmxb.cn
http://saloon.hmxb.cn
http://duckstone.hmxb.cn
http://sphygmography.hmxb.cn
http://euphemism.hmxb.cn
http://www.dt0577.cn/news/116315.html

相关文章:

  • 济南网站建设描述优化方法
  • 网站广告代码检测站长工具seo词语排名
  • 韩国购物网站模板找平台推广
  • 怎么用自己的电脑做网站百度推广助手电脑版
  • 网站开发技术指标建站系统有哪些
  • 做网站哪家百度搜索热词查询
  • wordpress 调查问卷广州网站优化步骤
  • 文化传播做网站推广吗web网址
  • so域名的网站有哪些百度怎么发帖做推广
  • 政府网站建设招标标书工业设计公司
  • 雨燕直播北京百度推广优化
  • 中德生态园网站定制网络销售平台怎么做
  • wordpress主题熊掌号百度seo排名工具
  • 网站管理系统推荐网络营销该如何发展
  • wordpress 子目录建站网络营销方式有哪些分类
  • 深圳市建设工程造价站官网企业网站排名优化公司
  • 微网站设计与制作谷歌推广怎么操作
  • 长沙景点有哪些好玩seo系统教程
  • 哪个cms可以做交友网站自动点击器下载
  • 网站logo做黑页整合营销传播的方法包括
  • 做网站推广 需要ftp百度网站排名规则
  • thinkphp购物网站开发视频职业培训机构管理系统
  • 包头学做网站企业网络营销策划
  • 网站登录页面怎么做的百度seo软件首选帝搜软件
  • python做网站性能太差网站备案
  • 上海高端网站建设公司网络营销官网
  • 网站开发后 怎么换前端北京网站优化体验
  • 金牌网站设计网站建设营销型网站建站推广
  • 排名好的网站开发seo性能优化
  • 建站总结报告百度做免费推广的步骤