Python自定义简单图轴简单实例

作者:mengwei 时间:2021-09-22 22:56:32 

简单定义图轴:


import numpy as np
import matplotlib.pyplot as plt

创建一个简单的matplotlib实例:


fig = plt.figure()
rect = fig.patch # a rectangle instance
rect.set_facecolor('lightgoldenrodyellow')

ax1 = fig.add_axes([0.1, 0.3, 0.4, 0.4])
rect = ax1.patch
rect.set_facecolor('lightslategray')

for label in ax1.xaxis.get_ticklabels():
 # label is a Text instance
 label.set_color('red')
 label.set_rotation(45)
 label.set_fontsize(16)

for line in ax1.yaxis.get_ticklines():
 # line is a Line2D instance
 line.set_color('green')
 line.set_markersize(25)
 line.set_markeredgewidth(3)

plt.show()

效果展示:

Python自定义简单图轴简单实例

脚本运行时间:(0分0.021秒)

来源:https://matplotlib.org/index.html

标签:python,matplotlib
0
投稿

猜你喜欢

  • 基于Python+Turtle实现绘制简易的大风车

    2021-02-25 18:52:11
  • golang 实现tcp转发代理的方法

    2023-08-06 02:46:55
  • python计算机视觉opencv矩形轮廓顶点位置确定

    2022-06-07 16:30:44
  • Python cookbook(数据结构与算法)实现对不原生支持比较操作的对象排序算法示例

    2021-08-14 18:38:06
  • python人工智能自定义求导tf_diffs详解

    2023-06-11 13:31:51
  • ASP checkbox复选框是否被选中的代码(结合数据库)

    2011-03-06 11:21:00
  • python文件操作的基础详细讲解(write、read、readlines、readline)

    2021-04-05 19:31:44
  • Python3之读取连接过的网络并定位的方法

    2022-02-20 00:36:43
  • Python使用Py2neo创建Neo4j的节点和关系

    2023-07-20 02:51:45
  • django主动抛出403异常的方法详解

    2023-03-28 17:40:10
  • python工具快速为音视频自动生成字幕(使用说明)

    2021-04-14 15:15:26
  • Django drf请求模块源码解析

    2023-06-07 10:03:07
  • 实现有批量删除功能的ASP留言板

    2007-10-31 07:27:00
  • 基于python指定包的安装路径方法

    2023-06-04 03:10:02
  • Python time模块之时间戳与结构化时间的使用

    2024-01-02 09:07:51
  • PyGame贪吃蛇的实现代码示例

    2021-04-27 12:09:33
  • 一种特别简单的MySQL数据库安装方法

    2008-12-17 15:30:00
  • 浅谈python print(xx, flush = True) 全网最清晰的解释

    2022-01-28 21:45:48
  • 泛域名设置问题

    2008-03-25 10:03:00
  • python matplotlib.pyplot.plot()参数用法

    2023-07-13 17:39:48
  • asp之家 网络编程 m.aspxhome.com