import matplotlib.pyplot as plt
import numpy as np x=np.linspace(-3,3,50)
y1=x*2+1
y2=x**2
plt.plot(x,y1) plt.figure(num=3,figsize=(8,5))
plt.plot(x,y2)
plt.plot(x,y1,color="red",linewidth=1.0,linestyle="--") plt.xlim((-1,2))
plt.ylim((-2,3))
plt.xlabel("I am x")
plt.ylabel("I am y") new_ticks=np.linspace(-1,2,5)
print(new_ticks)
plt.xticks(new_ticks)
plt.yticks([-2,-1.8,-1,1.22,3,],
[r'$really\ bad$',r'$bad\ \alpha$',r'$normal$',r'$good$','$really\ good$'] 

#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')
  ax.yaxis.set_ticks_position('left')
  ax.spines['bottom'].set_position(('data',0))
  ax.spines['left'].set_position(('data',0))

plt.show()

figure设置坐标轴的更多相关文章

  1. Matlab绘图基础——axis设置坐标轴取值范围

    peaks; axis tight  %Set the axis limits to equal the range of the data  axis square axis 'auto x'  % ...

  2. matplotlib交互模式与pacharm单独Figure设置

    matplotlib交互模式与pacharm单独Figure设置 觉得有用的话,欢迎一起讨论相互学习~Follow Me Matpotlib交互模式 在运行python程序时有时候需要生成以下的 动态 ...

  3. matplotlib画图教程,设置坐标轴标签和间距

    大家好,欢迎来到周四数据处理专题,我们今天继续matplotlib作图教程. 在上周的文章当中我们介绍了如何通过xlabel和ylabel设置坐标轴的名称,以及这两个函数的花式设置方法,可以设置出各种 ...

  4. ChartControl设置坐标轴范围

    需求:有一条坐标轴是用来表示百分比的,所以刻度范围只能是从0 - 100: 解决方法:运行chatcontrol设计器,选中需要设置的轴,如下图: 设置Whole range 的最大最小值: 默认情况 ...

  5. Python matplotlib绘图设置坐标轴的标题

    一.语法简介 plt.xlabel("销售月份",fontsize=16,color='red',fontweight='bold',loc='center',background ...

  6. 【划重点】Python matplotlib绘图设置坐标轴的刻度

    一.语法简介 plt.xticks(ticks,labels,rotation=30,fontsize=10,color='red',fontweight='bold',backgroundcolor ...

  7. python画图设置坐标轴大小

    在console端输入python语句,会一句输一行,而且不保留你所做的操作,但是每一句之间加一个分号就能很好的解决. import pylab as Plot Plot.xlim(-150, 150 ...

  8. Python数据可视化Matplotlib——Figure画布背景设置

    之前在今日头条中更新了几期的Matplotlib教学短视频,在圈内受到了广泛好评,现应大家要求,将视频中的代码贴出来,方便大家学习. 为了使实例图像显得不单调,我们先将绘图代码贴上来,此处代码对Fig ...

  9. matplotlib坐标轴设置-【老鱼学matplotlib】

    我们可以对坐标轴进行设置,设置坐标轴的范围,设置坐标轴上的文字描述等. 基本用法 例如: import numpy as np import pandas as pd import matplotli ...

随机推荐

  1. Django专题-AJAX

    AJAX准备知识:JSON 什么是 JSON ? JSON 指的是 JavaScript 对象表示法(JavaScript Object Notation) JSON 是轻量级的文本数据交换格式 JS ...

  2. 笔记本安装SSD固态硬盘详细的优化设置

    现在好多笔记本.台式机都加上固态硬盘了,固态硬盘的优势大家应该都有所了解了,在此略写一下固态硬盘优势:  1.启动快,没有电机加速旋转的过程:  2.不用磁头,快速随机读取,读延迟极小:  3.相对固 ...

  3. 画一画BeagleboneBlack的PCB

    一直有听说“Cadence是这个星球上第一好用的EDA软件”,便想着找机会来学学.正好BeagleboneBlack是用Cadence设计的,而且是开源硬件,原理图和PCB文件可以直接在Wiki上下载 ...

  4. 吴裕雄--天生自然python TensorFlow图片数据处理:解决TensorFlow2.0 module ‘tensorflow’ has no attribute ‘python_io’

    tf.python_io出错 TensorFlow 2.0 中使用 Python_io 暂时使用如下指令: tf.compat.v1.python_io.TFRecordWriter(filename ...

  5. 启动查看crontab日志服务

    方法1: . 修改rsyslog文件,将/etc/rsyslog.d/-default.conf 文件中的#cron.*前的#删掉: . 重启rsyslog服务service rsyslog rest ...

  6. 对象数组和for循环遍历输出学生的信息

    public class Student { private int no; private String name; private int age; public Student(int no, ...

  7. FastJson禁用循环引用检测

    我们先来看一个例子: package com.elong.bms; import java.io.OutputStream; import java.util.HashMap; import java ...

  8. [NOIP 2002普及组]产生数(floyd+高精度)

    https://www.luogu.org/problem/P1037 题目描述 给出一个整数 n(n<1030) 和 k 个变换规则(k<=15). 规则: 一位数可变换成另一个一位数: ...

  9. [LC] 659. Split Array into Consecutive Subsequences

    Given an array nums sorted in ascending order, return true if and only if you can split it into 1 or ...

  10. C# 接口练习

    #define debug using System; using System.Collections; namespace ConsoleApp1 { interface IAnimal { in ...