python 2.7 - pandas: multi-x-axis to multi-y-axis plot using chart -
i've data-frame below
period backed closed failed successful total 0 2015_november 1 0 0 7 8 1 2015_december 0 0 0 30 30 2 2016_january 0 1 0 46 47 3 2016_february 0 0 2 72 74 4 2016_march 0 1 0 56 57 5 2016_april 1 0 0 52 53 6 2016_may 2 4 1 50 57 7 2016_june 2 2 2 102 108 8 2016_july 0 0 0 10 10 10 grand_total 6 8 5 425 444
i can plot fine using period
x-axis
, backed
,closed
,failed
,successful
y axis using following code.
# create chart object. chart = workbook.add_chart({'type': 'column'}) # configure series of chart dataframe data. col_num in range(2, len(df3.columns) ): chart.add_series({ 'name': ['modified_data', 0, col_num], 'categories': ['modified_data', 1, 1, (len(df3.index) - 1 ), 1], # rows , columns 'values': ['modified_data', 1, col_num, (len(df3.index) - 1 ), col_num], 'fill': {'color': brews['spectral'][col_num - 1]}, 'gap': 200, }) # insert chart worksheet. ws2.insert_chart('b14', chart)
here graph:
however, i've requirement separate period
year
, 'month
, use both on x axis plot against backed closed failed successful total
in y axis.
separated them new data-frame below.
year start_month backed closed failed successful total 0 2015 november 1 0 0 7 8 1 2015 december 0 0 0 30 30 2 2016 january 0 1 0 46 47 3 2016 february 0 0 2 72 74 4 2016 march 0 1 0 56 57 5 2016 april 1 0 0 52 53 6 2016 may 2 4 1 50 57 7 2016 june 2 2 2 102 108 8 2016 july 0 0 0 10 10 10 grand total 6 8 5 425 444
however i'm unable find solution multi-x-axis multi-y-axis plot using charts
generate plot same above. can combine year , start_month
, use x-axis
plotting purpose? while on excel-data still show 2 separate columns.
any pointers welcome.
Comments
Post a Comment