I am plotting 4 subplots as follows:
def plot_bar(corr_df):
dfstacked = corr_df.stack().order()
dfstacked.plot(kind='bar', rot=60)
def plot_heatmap(corr_df):
corr_df = corr_df.fillna(value=0)
plt.pcolormesh(corr_df.values, cmap=plt.cm.Blues)
plt.yticks(np.arange(0.5, len(corr_df.index), 1), corr_df.index)
plt.xticks(np.arange(0.5, len(corr_df.columns), 1), corr_df.columns)
plt.subplot2grid((2,5), (0,0), colspan=3)
plot_bar(df)
plt.subplot2grid((2,5), (0,3), colspan=2)
plot_heatmap(df)
plt.subplot2grid((2,5), (1,0), colspan=3)
plot_bar(df)
plt.subplot2grid((2,5), (1,3), colspan=2)
plot_heatmap(df)
plt.tight_layout()
plt.show()
The plot is created correctly, however the x-axis labels are missing on one of the bar charts on the left hand side. The labels are always missing from whichever bar chart is plotted 1st out of the 2 bar charts.
So if I plot the bar chart in position 0,0 first then that is the one which will have no x-axis labels. If I plot the chart in position 1,0 first, then that one will be missing the labels.
I presume it has something to do with the fact that the labels are quite long and are getting cut off by the bar chart plotted 2nd,...but im not sure.
EDIT:
Here's the dataframe example. Just set_index to symbol:
symbol aaa bbb ccc ddd eee fff ggg
aaa
bbb -0.001
ccc 0.348 -0.025
ddd -0.42 -0.075 -0.701
eee -0.276 0.004 -0.516 0.661
fff 0.175 -0.107 0.363 -0.521 -0.356
ggg 0.469 0.012 0.364 -0.519 -0.306 0.306