When comparing two different Y variables, there is no real way of knowing which chart type belongs to which Y-Axis. I need a legend that says which chart type belongs to which data set.
With help from this site itself I've been able to plot different categorized factors using different chart types, but as you can see there is no way to tell which chart type belongs to which factor/variable
This is the data table(tm_daily_df), and the current code
report_date shift UTL_R Head_Count
0 2019-03-17 A 0.669107 39
1 2019-03-18 A 0.602197 69
2 2019-03-19 A 0.568741 72
3 2019-03-20 A 0.552013 78
4 2019-03-21 A 0.585469 57
5 2019-03-22 A 0.635652 61
6 2019-03-23 A 0.602197 51
7 2019-03-17 1 0.828020 16
8 2019-03-17 2 0.585469 8
9 2019-03-17 3 0.526922 15
10 2019-03-18 1 0.618924 30
11 2019-03-18 2 0.610560 20
12 2019-03-18 3 0.577105 19
13 2019-03-19 1 0.610560 28
14 2019-03-19 2 0.602197 26
15 2019-03-19 3 0.468375 18
16 2019-03-20 1 0.543650 33
17 2019-03-20 2 0.552013 26
18 2019-03-20 3 0.552013 19
19 2019-03-21 1 0.577105 22
20 2019-03-21 2 0.585469 19
21 2019-03-21 3 0.602197 16
22 2019-03-22 1 0.593833 26
23 2019-03-22 2 0.685835 20
24 2019-03-22 3 0.635652 15
25 2019-03-23 1 0.577105 23
26 2019-03-23 2 0.627288 16
27 2019-03-23 3 0.602197 12
fig, ax = plt.subplots(figsize=(15,6))
g = sns.lineplot(x='report_date', y='UTL_R', data=tm_daily_df, ax=ax, hue = 'shift', legend = None,
marker='o', markersize=10)
ax2 = ax.twinx()
g = sns.barplot(x='report_date', y='Head_Count', data=tm_daily_df, ax=ax2, hue='shift',alpha=.5)
ax.set_title('Utilization Ratio vs HeadCount')
plt.show()
I want to have a legend that says which chart type belongs to which data set. In this case, there would be a secondary legend that shows a line and the word "UTL_R" and a square(or whatever would represent a bar graph) next to the word "Head_Count" . I'm also open to any other ideas that can define the applied chart types. Keep in mind this graph is one of many from a huge set of variables, it's not a single instance.
Is there maybe a way i can just put an image/small table into the figure if this is not possible?