平行坐标绘图
paracoord的Python项目详细描述
paracoord:以平行坐标绘制二维数组
目的
这个包试图实现 parallel coordinates 从Sébastien Tricaud和 Philippe Saadé到一般用途。
示例
from paracoord import get_paracoord_plot
# Create 10x5 random array
values = np.random.random_sample((10, 5))
print(values)
# Plot parallel coordinates of those values
get_paracoord_plot(values)
# Set arbitrary labels for those 10 5-dimensional vectors
labels = ['aaa', 'bbb', 'aaa', 'ccc', 'bbb', 'aaa', 'aaa', 'bbb', 'aaa', 'ccc']
# Plot them in parallel coordinates with automatically chosen colors
get_paracoord_plot(values, labels=labels)
# Plot them with self defined color dict and save the resulting plot
color_dict = {'aaa': 'b', 'bbb': 'r', 'ccc': 'g'}
get_paracoord_plot(values, labels=labels, color_dict=color_dict, save_path='random_example.jpg', set_legend=True)
选项
values
:二维numpy数组labels
:可选,数组包含values
的每一行的标签color_dict
:dict,可选,如果未提供labels
则忽略。{标签->;颜色}dict。 如果提供的是labels
,而不是color_dict
,则会自动选择每个标签的颜色save_path
:存储结果图像的文件的路径。 如果未提供,则不会存储图像set_legend
:布尔型,可选,如果未提供labels
则忽略。是否为标签设置颜色图例box
:布尔型。如果要为生成的图像 设置帧(X轴、Y轴等)
ylims
:(ymin,ymax)。如果未提供,则将结果设置为get_y_min_nax(values)
安装
pip install paracoord
最后说明
享受吧,你想怎么做就怎么做,只要你不让我承担后果:) 建议、评论、批评、请求获得赞赏