combineMethodComparisions.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import pandas as pd
  2. from matplotlib import pyplot as plt
  3. import seaborn as sns
  4. import os
  5. import sys
  6. from regmaxsn.core.matplotlibRCParams import mplPars
  7. sns.set(rc=mplPars)
  8. setNames = ["LCInt", "ALPN", "OPInt", "AA1", "AA2"]
  9. intSetNames = ["LLC", "OMB", "OPSInt", "AA1", "RAL"]
  10. def combinePlotMethodComparisons(inDir):
  11. plt.ion()
  12. allPerfsDF = pd.DataFrame()
  13. for setInd, setName in enumerate(setNames):
  14. intSetName = intSetNames[setInd]
  15. metricsXL = os.path.join(inDir, "{}.xlsx".format(intSetName))
  16. if os.path.isfile(metricsXL):
  17. metricsDF = pd.read_excel(metricsXL)
  18. metricsDF["Group"] = setName
  19. allPerfsDF = allPerfsDF.append(metricsDF, ignore_index=True)
  20. [darkblue, green, red, violet, yellow, lightblue] = sns.color_palette()
  21. fig1, ax1 = plt.subplots(figsize=(14, 11.2))
  22. sns.barplot(data=allPerfsDF, x="Group", y="Occupancy Based Dissimilarity Measure",
  23. hue='Method', ax=ax1, hue_order=["PCA", "PCA + RobartsICP", "BlastNeuron",
  24. "Reg-MaxS", "Reg-MaxS-N", "Standardized"],
  25. palette=[red, violet, yellow, lightblue, darkblue, green])
  26. ax1.set_ylabel("Occupancy Based Dissimilarity Measure")
  27. ax1.set_xticklabels(setNames)
  28. # ax1.text(0, 12, 'n=4', color='r', fontsize=48)
  29. fig1.tight_layout()
  30. return fig1
  31. if __name__ == "__main__":
  32. assert len(sys.argv) == 2, "Improper Usage! Please use as:\n" \
  33. "python {} <directory with performance excel files".format(sys.argv[0])
  34. fig = combinePlotMethodComparisons(sys.argv[1])