import matplotlib.pyplot as plt
import numpy as np def f(x,y):
# the height function
return (1 - x / 2 + x**5 + y**3) * np.exp(-x**2 -y**2) n = 256
x = np.linspace(-3, 3, n)
y = np.linspace(-3, 3, n)
X,Y = np.meshgrid(x, y) # use plt.contourf to filling contours
# X, Y and value for (X,Y) point
plt.contourf(X, Y, f(X, Y), 8, alpha=.75, cmap=plt.cm.cool) # use plt.contour to add contour lines
C = plt.contour(X, Y, f(X, Y), 8, colors='black', linewidth=0.5)
# adding label
plt.clabel(C, inline=True, fontsize=10) plt.xticks(())
plt.yticks(())
plt.show()

  

Contour等高线图代码的更多相关文章

  1. 深度学习原理与框架-神经网络-线性回归与神经网络的效果对比 1.np.c_[将数据进行合并] 2.np.linspace(将数据拆成n等分) 3.np.meshgrid(将一维数据表示为二维的维度) 4.plt.contourf(画出等高线图,画算法边界)

    1. np.c[a, b]  将列表或者数据进行合并,我们也可以使用np.concatenate 参数说明:a和b表示输入的列表数据 2.np.linspace(0, 1, N) # 将0和1之间的数 ...

  2. 蚂蚁金服新一代数据可视化引擎 G2

    新公司已经呆了一个多月,目前着手一个数据可视化的项目,数据可视化肯定要用到图形库如D3.Highcharts.ECharts.Chart等,经决定我的这个项目用阿里旗下蚂蚁金服所开发的G2图表库. 官 ...

  3. ggplot2(4) 用图层构建图像

    4.1 简介 qplot()的局限性在于它只能使用一个数据集和一组图形属性映射,解决这个问题的办法就是使用图层.每个图层可以有自己的数据集和图形属性映射,附加的数据元素可通过图层添加到图形中. 一个图 ...

  4. MATLAB函数表(转自:http://bbs.06climate.com/forum.php?mod=viewthread&tid=16041&extra=page%3D4)

    MATLAB函数表 4.1.1特殊变量与常数 ans 计算结果的变量名 computer 确定运行的计算机 eps 浮点相对精度 Inf 无穷大 I 虚数单位 inputname 输入参数名 NaN ...

  5. Python Matplotlib简易教程【转】

    本文转载自:https://blog.csdn.net/Notzuonotdied/article/details/77876080 详情请见:Matplotlib python 数据可视化神器 简单 ...

  6. matlab 常用函数汇总

    1. 特殊变量与常数 主题词 意义 主题词 意义 ans 计算结果的变量名 computer 确定运行的计算机 eps 浮点相对精度 Inf 无穷大 I 虚数单位 inputname 输入参数名 Na ...

  7. Visdom 介绍 | 二

    用于创建,组织和共享实时丰富数据可视化的灵活工具.支持Python. 概述 概念 设置 用法 API 注意事项 贡献 API 要快速了解visdom的功能,请查看example目录,或阅读以下详细信息 ...

  8. OpenCV学习代码记录——轮廓(contour)检测

    很久之前学习过一段时间的OpenCV,当时没有做什么笔记,但是代码都还在,这里把它贴出来做个记录. 代码放在码云上,地址在这里https://gitee.com/solym/OpenCVTest/tr ...

  9. [转载]用等高线图(Contour maps)可视化多变量函数

    https://blog.csdn.net/xlinsist/article/details/50920479 Overview 由于我们用手来画三维图像很困难,我们可以用等高线图来描述图像会更加简单 ...

随机推荐

  1. HTML字符实体和转义字符串大全

    转义字符串的组成 转义字符串(Escape Sequence),即字符实体(Character Entity)分成三部分:第一部分是一个&符号,英文叫ampersand:第二部分是实体(Ent ...

  2. mysql group_concat和find_in_set的使用

    原先sql获取角色对应的权限信息: select a.*, group_concat(b.auth_name) as auth_name from sh_role a left join sh_aut ...

  3. Java8必知必会

    Java SE 8添加了2个对集合数据进行批量操作的包: java.util.function 包以及 java.util.stream 包. 流(stream)就如同迭代器(iterator),但附 ...

  4. 吴裕雄--天生自然 JAVA开发学习:包(package)

    package pkg1[.pkg2[.pkg3…]]; package net.java.util; public class Something{ ... } package animals; i ...

  5. layui子弹框调用父弹框方法

    var thisFrame = parent.window.document.getElementById("LAY_layuiStampDuty1").getElementsBy ...

  6. TPO5-3 The Cambrian Explosion

    At one time, the animals present in these fossil beds were assigned to various modern animal groups, ...

  7. html中table的px与百分比格式设置

    PX是Pixel的缩写,也就是说像素是指基本原色素及其灰度的基本编码,由 Picture(图像) 和 Element(元素)这两个单词的字母所组成的 Html设置table格式时面临着百分比还是px的 ...

  8. Codeforces Round #579 (Div. 3) Complete the Projects(贪心、DP)

    http://codeforces.com/contest/1203/problem/F1 Examples input 1 - - output 1 YES input 2 - - output 2 ...

  9. mysql中datetime时间转字符串(避免java层映射为数字串)

    -- in_date datetime NULLDATE_FORMAT(ls.`in_date`,'%Y-%m-%d %T')AS create_time

  10. [LC] 1170. Compare Strings by Frequency of the Smallest Character

    Let's define a function f(s) over a non-empty string s, which calculates the frequency of the smalle ...