python-3.x - Matplot Lib 图形在左侧被截断,标签未显示
问题描述
我的水平条形图的标签在 matplot lib 中被截断。我怀疑这是因为我做了一些标签重新分配。但我不确定。有没有办法强制图像更大/向左延伸,所以它不会被截断?我在下面添加了我的代码以了解我的意思。
df_1 = df_1.astype({"Education": 'str', "Count": 'int64'}) #Converting the first column from float to string
print(df_1.dtypes) #Check the types
df_1.at[0,'Education'] = "High School" #Reassign the labels to what they actually mean
df_1.at[1,'Education'] = "Trade School"
df_1.at[2,'Education'] = "Bachelor's Degree"
df_1.at[3,'Education'] = "Graduate Degree"
print(df_1)
df_1.plot.barh(x='Education', y='Count', title='Hope this works', color='blue', stacked=True)
这是我得到的图像。
这是我得到的图像。 抱歉,如果这不是足够的信息,这是我第一次发布。
解决方案
推荐阅读
- java - 修复应用程序不断停止使用 android studio
- javascript - “TypeError: Cannot read properties of undefined (reading '0')”在从 React/redux 检索数据时从 React 中的数组访问数据时
- java - 猜图像游戏,无重复的随机图像生成器
- python - numba.core.errors.TypingError:使用 np.random.randint() 时
- pdf - 有没有办法下载我有查看权限并且只有链接的谷歌幻灯片文档?
- angular - 检测到循环依赖中的警告 - 自从更新到 Angular 10
- r - 使用(样条)变换调整列线图刻度,rms 包 [R]
- android - TextToSpeech 不发音第一个视频的名称
- autohotkey - 我想获取特定像素的颜色并在每次它具有颜色 FF8F4B 时单击它。我怎样才能做到这一点?
- gemfire - 在 Gem fire 中启动服务器时面临的问题