如何使用轴对象使一条线比其他线厚

2024-06-09 17:12:20 发布

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

我有一个正在绘制的数据帧。我需要将y轴的下限改为0,更重要的是使阿根廷的线比其他线更粗

我已经将csv文件读入Python并绘制了它,现在我只需要对绘图进行调整

debt=pd.read_csv(“http://pages.stern.nyu.edu/~dbackus/Data/debt.csv”)

债务=债务。设置_指数(['年])

图,ax=plt.子批次()

图(ax=ax,线宽=2)


Tags: 文件csv数据http绘图read绘制pages
1条回答
网友
1楼 · 发布于 2024-06-09 17:12:20

像那样的吗

import pandas as pd
import matplotlib.pyplot as plt
debt = pd.read_csv('http://pages.stern.nyu.edu/~dbackus/Data/debt.csv')

debt = debt.set_index(['Year'])

fig, ax = plt.subplots()
debt['ARG'].plot(ax = ax, linewidth = 1)
debt['DEU'].plot(ax = ax, linewidth = 3)
debt['GRC'].plot(ax = ax, linewidth = 5)

相关问题 更多 >