【发布时间】:2016-05-26 22:57:20
【问题描述】:
如何在 python 中使用 matplotlib 等绘制纵向数据。
from pandas import DataFrame
from scipy.stats import norm
from scipy.stats import randint
import numpy as np
import pandas as pd
# some sample data
df = DataFrame({
'one' : norm.rvs(loc=12, size=10),
'two' : norm.rvs(loc=5, size=10),
'three' : norm.rvs(loc=7, size=10),
'four' : norm.rvs(loc=3, size=10),
'type' : ['type-%i' % i for i in randint.rvs(0,3,size=10)]})
如何在 x 轴上绘制重复测量的标签:1-2-3-4,并为 10 个样本中的每一个绘制一条连接它们各自值的线?如何按类型为每个样本着色?
【问题讨论】:
标签: python pandas matplotlib plot seaborn