python3模块在使用plotille绘制之前对数据集重新采样。

plotilleresample的Python项目详细描述


plotilleresample

python3模块,在使用plotille绘制之前对数据集重新采样。

基本原理

我想优化plotille的plot和scatter函数。

安装

使用pip

安装
pip3 install -U servusresample

用法

#!/usr/bin/env python3

import plotille

import plotilledimreduction

import math

from shutil import get_terminal_size

from vtclear import clear_screen

import numpy as np


w = get_terminal_size().columns - 20
h = get_terminal_size().lines - 7

r = 10000
res = np.random.normal(size=r)

# Here I'm testing stuffs with histograms.
# input("Histogram:")
# print(plotille.histogram(res, bins=w*2, width=w, height=h))

X = [i for i in range(r)]
Y = [math.sin(i / 100) * 100 for i in range(r)]

print(" · Scatter...")
xs, ys = plotilledimreduction.dim_reduction_scatter(X, Y, w, h)
print(" · Plot...")
xp, yp = plotilledimreduction.dim_reduction_plot(X, Y, w, h)
print(" --- READY ---")

print(f"Len plot.x {len(xp)}")

print(f"Len scatter.x {len(xs)}")

input("Plot:")
clear_screen()
print(plotille.plot(xp, yp, w, h))

input("Scatter:")
clear_screen()
print(plotille.plot(xs, ys, w, h))

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
未使用Thymeleaf解析java消息参数   java试图为应用程序的每个实例创建一个具有唯一名称的表   eclipse如何用moduleinfo替换VM参数。java文件   java如何使JTextField不接受后缀字符串中的空格   Android中的java序列化文件   java如何缓存hibernate集合?   Android Eclipse导航抽屉中的java标头ImageView   java StreamTokenizer将001_到003拆分为两个令牌;我如何防止它这样做?   java应用程序必须只有一个DBHelper类,还是可以有多个DBHelper类?   java通过使用键作为值来反序列化Jackson   java JPA/Hibernate如何定义实体上的自定义联接子句?   JavaJunit/对Junit方法的误解   java JSP文件未加载到浏览器白标签错误页面   在Java构造函数中设置数据时出现NullPointerException   如果Java中的数组已满,如何将值传递给类中的另一个方法?   java如何在try/catch语句中返回字符串?   java需要以hh:mm格式获取两个日期之间的时差