I have two dataframes df1
and df2
. df2
is subset of df1
. I want to draw horizontal bar plot of df1
having identified df2
rows (different bar color or something). Thank you.
%matplotlib inline
import pandas as pd
import matplotlib as plt
d1 = {
'index' : [1, 2, 3, 4, 5],
'col1' : [5, 8, 6, 4, 2]
}
d2 = {
'index' : [3, 5],
'col1' : [6, 2]
}
df1 = pd.DataFrame(d1).set_index(["index"])
df2 = pd.DataFrame(d2).set_index(["index"])
df1.plot(kind="barh", grid=False)