主要问题是如果我有三个数据集文件的计数图,如何删除图形中的“标签”命名空间?我正在使用 Seaborn 模块。
#Importing the libraries
import pandas as pd
import numpy as np
import seaborn as sb
#Reading the files
train_filename = 'train.csv'
test_filename = 'test.csv'
valid_filename = 'valid.csv'
train_news = pd.read_csv(train_filename)
test_news = pd.read_csv(test_filename)
valid_news = pd.read_csv(valid_filename)
#Data observation
def data_obs():
print("Training dataset size:")
print(train_news.shape)
print(train_news)
print("Testing dataset size:")
print(test_news.shape)
print(test_news)
print("Validation dataset size:")
print(valid_news.shape)
print(valid_news)
print(data_obs())
这是我从数据中得到的结果 enter image description here另外,我正在使用 LIAR 数据集,它具有以下功能:
enter image description here
最佳答案
这应该这样做:
g = sb.countplot(x='Label', data=dataFile, palette="hls")
g.set(xticklabels=[]) # To remove the ticklabels
g.set(xlabel=None) # To remove the "Label"
关于python - 如何从 Seaborn 的计数图图形中删除标签名称?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65541515/