CS231n-机器学习中matplotlib绘图基础.md
来源:互联网 发布:char占几个字节 java 编辑:程序博客网 时间:2024/06/03 17:28
绘制函数
import numpy as npimport matplotlib.pyplot as plt# Compute the x and y coordinates for points on a sine curvex = np.arange(0, 3 * np.pi, 0.1)y = np.sin(x)# Plot the points using matplotlibplt.plot(x, y)plt.show() # You must call plt.show() to make graphics appear.
增强函数绘制
import numpy as npimport matplotlib.pyplot as plt# Compute the x and y coordinates for points on sine and cosine curvesx = np.arange(0, 3 * np.pi, 0.1)y_sin = np.sin(x)y_cos = np.cos(x)# Plot the points using matplotlibplt.plot(x, y_sin)plt.plot(x, y_cos)plt.xlabel('x axis label')plt.ylabel('y axis label')plt.title('Sine and Cosine')plt.legend(['Sine', 'Cosine'])plt.show()
多图绘制
import numpy as npimport matplotlib.pyplot as plt# Compute the x and y coordinates for points on sine and cosine curvesx = np.arange(0, 3 * np.pi, 0.1)y_sin = np.sin(x)y_cos = np.cos(x)# Set up a subplot grid that has height 2 and width 1,# and set the first such subplot as active.plt.subplot(2, 1, 1)# Make the first plotplt.plot(x, y_sin)plt.title('Sine')# Set the second subplot as active, and make the second plot.plt.subplot(2, 1, 2)plt.plot(x, y_cos)plt.title('Cosine')# Show the figure.plt.show()
import numpy as npfrom scipy.misc import imread, imresizeimport matplotlib.pyplot as pltimg = imread('assets/cat.jpg')img_tinted = img * [1, 0.95, 0.9]# Show the original imageplt.subplot(1, 2, 1)plt.imshow(img)# Show the tinted imageplt.subplot(1, 2, 2)# A slight gotcha with imshow is that it might give strange results# if presented with data that is not uint8. To work around this, we# explicitly cast the image to uint8 before displaying it.plt.imshow(np.uint8(img_tinted))plt.show()
1 0
- CS231n-机器学习中matplotlib绘图基础.md
- CS231n-机器学习中numpy基础.md
- CS231n-机器学习中Python基础教程.md
- matplotlib学习之绘图基础
- matplotlib学习之绘图基础
- matplotlib学习之绘图基础
- matplotlib学习之绘图基础
- matplotlib学习之绘图基础
- 从零开始机器学习实战2-Matplotlib绘图
- matplotlib绘图基础
- matplotlib绘图基础
- matplotlib绘图基础
- matplotlib绘图基础
- matplotlib绘图基础--1
- matplotlib绘图基础--2
- matplotlib绘图基础--3
- matplotlib绘图基础
- matplotlib绘图基础--笔记
- JSP使用AJAX与Servlet互相传值
- HDU 2063 过山车 二分匹配模板题
- 在一个service中启动Activity
- LevelDB学习之路--README.MD
- sha1加密java代码
- CS231n-机器学习中matplotlib绘图基础.md
- iOS App Extension入门
- Leetcode-31. Next Permutation
- Servlet 生命周期、工作原理
- Tomcat配置Https协议
- cSS文件中第一行@charset "utf-8";的作用
- 存储结构与磁盘划分
- 单片机—花样灯—代码
- 颜色平衡和偏色调节