安德鲁斯在玉米上绘制随机数

2024-06-08 05:04:29 发布

您现在位置:Python中文网/ 问答频道 /正文

我试着用安德鲁斯曲线图来描绘一些国家的数据,但数字‘1e12’一直出现在右上角,我不知道为什么会出现,也不知道如何去掉它。这是情节本身:

enter image description here

这是我用来制作它的代码,相当标准的安德鲁斯情节:

import pandas as pd
import matplotlib.pyplot as plt
from pandas.tools.plotting import radviz
from pandas.tools.plotting import table 
from pandas import read_csv
from pandas.tools.plotting import andrews_curves
import os

filepath ="/Users/.../DefenseAndrews.csv"
os.chdir(os.getcwd())
os.getcwd()
dc = read_csv(filepath,
header=0, usecols=['Country','GDP','ME','GE','Trade','PopDensity'])

plt.figure()
andrews_curves(dc, 'Country')
plt.legend(loc='best', bbox_to_anchor=(1.0, 4.3))
plt.savefig('figure4_AndrewsPlot.eps', format='eps', dpi=1200)
plt.show()

只是在我以前的一个程序中手动删除它。然而,我现在必须创建的图像作为一个eps文件,我不能编辑后,事实。任何帮助或建议将不胜感激。在


Tags: csvfromimportpandasreadosasplt
1条回答
网友
1楼 · 发布于 2024-06-08 05:04:29

这个值就是轴上的刻度。你必须用大约1.11倍的系数来划分数据。请参阅下面的虹膜数据示例。在

iris data linked here

from pandas.tools.plotting import andrews_curves

data1 = pd.read_csv('iris.csv')
data2 = data1.copy() 
data2.iloc[:, :4] *= 1e11

fig, axes = plt.subplots(1, 2, figsize=(10, 5))
andrews_curves(data1, 'Name', ax=axes[0])
andrews_curves(data2, 'Name', ax=axes[1])

enter image description here

你会注意到左边的图表没有这个刻度,而右边的图表有。我故意把右边图表上的数据乘以1.11倍。在

相关问题 更多 >

    热门问题