下のコードでは、3行の図をプロットすることができますが、角度があります。線を滑らかにすることは可能ですか?pythonの図の線を滑らかにする方法は?
import matplotlib.pyplot as plt
import pandas as pd
# Dataframe consist of 3 columns
df['year'] = ['2005, 2005, 2005, 2015, 2015, 2015, 2030, 2030, 2030']
df['name'] = ['A', 'B', 'C', 'A', 'B', 'C', 'A', 'B', 'C']
df['weight'] = [80, 65, 88, 65, 60, 70, 60, 55, 65]
fig,ax = plt.subplots()
# plot figure to see how the weight develops through the years
for name in ['A','B','C']:
ax.plot(df[df.name==name].year,df[df.name==name].weight,label=name)
ax.set_xlabel("year")
ax.set_ylabel("weight")
ax.legend(loc='best')
私はそれは同じ質問だとは思わない@poke。私は以前に他の質問の答えを試しています。私はなぜそれが動作しないのかわかりませんが、私は3列または2列しか持っていない他の質問の代わりにここで仕事をしなければならないので、少し違うと思います。 – Jolie
プロットする前にデータを補間する必要があります.SO – Boud