【Python】Matplotlib参数修改复杂?pylustrator鼠标点击修改!

  • Matplotlib功能强大,但是默认出图不够美观,需要一行一行代码调整参数美化图表;

  • 本次分享一个工具pylustrator,可通过点击鼠标修改图表配置参数,大大提高Matplotlib的使用效率。

7bd92f1b8f8a2eb3c452a52e2d2bc6c5.png

pylustrator安装

pip install pylustrator

pylustrator使用

只需要导入pylustrator,开启pylustrator即可,添加两行代码:

# 导入pylustrator 
import pylustrator 

# 开启pylustrator 
pylustrator.start()

举个例子,

import numpy as np
import matplotlib.pyplot as plt 

import pylustrator  
pylustrator.start() #开启pylustrator


def f(t):
    return np.exp(-t) * np.cos(2 * np.pi * t)


t1 = np.arange(0.0, 5.0, 0.1)
t2 = np.arange(0.0, 5.0, 0.02)

plt.style.use('ggplot')
plt.subplot(211)
plt.plot(t1, f(t1), color='tab:blue', marker='o')
plt.plot(t2, f(t2), color='black')

plt.subplot(212)
plt.plot(t2, np.cos(2 * np.pi * t2), color='tab:orange', linestyle='--')
plt.show()

cd8d40498d9f5bbd067ea546314a20bc.png会出现以上界面,鼠标点击即可修改参数,点击右上角File可保存代码或者修改后的图片。

进一步学习:https://github.com/rgerum/pylustrator

 
 
 
 

4b6d83fb6ffd7b5e83ace0839a9223f8.jpeg

 
 
 
 
 
 
 
 
往期精彩回顾




适合初学者入门人工智能的路线及资料下载(图文+视频)机器学习入门系列下载机器学习及深度学习笔记等资料打印《统计学习方法》的代码复现专辑机器学习交流qq群955171419,加入微信群请扫码

35c7007d04ccc7cc89f720bf54f06663.png

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值