莫烦-matplotlib学习笔记(三)
来源:互联网 发布:linux统计目录文件数 编辑:程序博客网 时间:2024/05/17 08:16
参考莫烦教学视频:https://morvanzhou.github.io/tutorials/data-manipulation/plt/2-4-axis2/
与matplotlib学习笔记(二)http://blog.csdn.net/weixin_39881922/article/details/78493400 中内容类似
import matplotlib.pyplot as pltimport numpy as npx = np.linspace(-3, 3, 50)y1 = 2*x + 1y2 = x**2plt.figure()plt.plot(x, y2)# plot the second curve in this figure with certain parametersplt.plot(x, y1, color='red', linewidth=1.0, linestyle='--')# set x limitsplt.xlim((-1, 2))plt.ylim((-2, 3))# set new ticksnew_ticks = np.linspace(-1, 2, 5)plt.xticks(new_ticks)# set tick labelsplt.yticks([-2, -1.8, -1, 1.22, 3], ['$really\ bad$', '$bad$', '$normal$', '$good$', '$really\ good$'])# to use '$ $' for math text and nice looking, e.g. '$\pi$'# gca = 'get current axis'ax = plt.gca()ax.spines['right'].set_color('none')ax.spines['top'].set_color('none')ax.xaxis.set_ticks_position('bottom')# ACCEPTS: [ 'top' | 'bottom' | 'both' | 'default' | 'none' ]ax.spines['bottom'].set_position(('data', 0))# the 1st is in 'outward' | 'axes' | 'data'# axes: percentage of y axis# data: depend on y dataax.yaxis.set_ticks_position('left')# ACCEPTS: [ 'left' | 'right' | 'both' | 'default' | 'none' ]ax.spines['left'].set_position(('data',0))plt.show()
阅读全文
0 0
- 莫烦-matplotlib学习笔记(三)
- Matplotlib学习笔记(三)
- 莫烦-matplotlib学习笔记(一)
- 莫烦-matplotlib学习笔记(二)
- 莫烦-matplotlib学习笔记(四)
- Matplotlib学习笔记(一)
- Matplotlib学习笔记(二)
- Matplotlib学习笔记(四)
- Matplotlib学习笔记(五)
- matplotlib 学习笔记(一)
- matplotlib 学习笔记(二)
- python学习(三):matplotlib学习
- python学习(三):matplotlib学习
- Python-学习笔记(三)——开发环境搭建(numpy,scipy,matplotlib)
- Python学习笔记(一)--- Matplotlib
- 机器学习笔记(一):matplotlib入门
- 机器学习笔记(二):matplotlib基础
- matplotlib学习笔记
- ADV-231-扑克排序
- java定时利用QQ邮件发送今日头条关于java的内容
- const,static,extern的不同
- <几天一题>插入排序
- 树莓派3B+ Git服务(GitLab)
- 莫烦-matplotlib学习笔记(三)
- 剑指offer 输出链表/逆序输出
- 变量、作用域与内存问题
- 例题8-8 防线(Defense Lines, ACM/ICPC CERC 2010, UVa1471)
- [转载]布尔代数入门
- unity简单小球下落
- 二叉搜索树的后序遍历序列 (剑指Offer 第 22 题)
- 基于Redis的分布式锁实现
- 读书笔记《C++ Primer》第五版——第十章 泛型算法