I believe that my problem is really straightforward and there must be a really easy way to solve this issue, however as I am quite new with Python, I could not sort it out. I saw some similar questions but none of them really relate to the problem that I am facing.
The code below is a simple example that I made in order to illustrate what is going on, it is somehow similar to the more complex scenario that I am working on. When you run it, you will see some things that I have been really trying to fix, however haven't had any sucess. So, I am looking for to improve the following: 1. Adjust the values of the x-axis to be shown only on the last graph 2. Eliminate the label of the x-axis and show it only on the last graph
import pandas as pd
import matplotlib.pyplot as plt
data = {'Column A': [300,300,300,500,500,500,500,300],
'Column B': [1,1,2,2,3,3,0,2],
'Column C': ["Value_1", "Value_2", "Value_3", "Value_4", "Value_1",
"Value_2", "Value_3", "Value_4"]}
df = pd.DataFrame(data, columns=['Column A','Column B', 'Column C'])
fig, ax = plt.subplots(len(df['Column C'].unique()),1, figsize=(12,14))
for i, val in enumerate(df['Column C'].unique()):
sdf = df.loc[df['Column C']==val]
sdf.plot(x='Column A', y='Column B', label='C = {}'.format(val), ax=ax[i])
Hope that I managed to be succinct and precise. I would really appreciate your help on this one!