adding plotstyle boxplots
This commit is contained in:
parent
4e7bd40ea4
commit
ea98a20a68
@ -108,9 +108,6 @@ def PlotStyle() -> None:
|
|||||||
@classmethod
|
@classmethod
|
||||||
def set_boxplot_color(cls, bp, color):
|
def set_boxplot_color(cls, bp, color):
|
||||||
plt.setp(bp["boxes"], color=color)
|
plt.setp(bp["boxes"], color=color)
|
||||||
plt.setp(bp["whiskers"], color=color)
|
|
||||||
plt.setp(bp["caps"], color=color)
|
|
||||||
plt.setp(bp["medians"], color=color)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def label_subplots(cls, labels, axes, fig):
|
def label_subplots(cls, labels, axes, fig):
|
||||||
@ -250,11 +247,11 @@ def PlotStyle() -> None:
|
|||||||
|
|
||||||
# dark mode modifications
|
# dark mode modifications
|
||||||
plt.rcParams["boxplot.flierprops.color"] = white
|
plt.rcParams["boxplot.flierprops.color"] = white
|
||||||
plt.rcParams["boxplot.flierprops.markeredgecolor"] = gray
|
plt.rcParams["boxplot.flierprops.markeredgecolor"] = white
|
||||||
plt.rcParams["boxplot.boxprops.color"] = gray
|
plt.rcParams["boxplot.boxprops.color"] = gray
|
||||||
plt.rcParams["boxplot.whiskerprops.color"] = gray
|
plt.rcParams["boxplot.whiskerprops.color"] = white
|
||||||
plt.rcParams["boxplot.capprops.color"] = gray
|
plt.rcParams["boxplot.capprops.color"] = white
|
||||||
plt.rcParams["boxplot.medianprops.color"] = gray
|
plt.rcParams["boxplot.medianprops.color"] = white
|
||||||
plt.rcParams["text.color"] = white
|
plt.rcParams["text.color"] = white
|
||||||
plt.rcParams["axes.facecolor"] = black # axes background color
|
plt.rcParams["axes.facecolor"] = black # axes background color
|
||||||
plt.rcParams["axes.edgecolor"] = gray # axes edge color
|
plt.rcParams["axes.edgecolor"] = gray # axes edge color
|
||||||
|
@ -19,8 +19,10 @@ logger = makeLogger(__name__)
|
|||||||
|
|
||||||
def main(datapath: str):
|
def main(datapath: str):
|
||||||
|
|
||||||
foldernames = [datapath + x + '/' for x in os.listdir(datapath) if os.path.isdir(datapath+x)]
|
foldernames = [
|
||||||
path_to_csv = ('/').join(foldernames[0].split('/')[:-2]) + '/order_meta.csv'
|
datapath + x + '/' for x in os.listdir(datapath) if os.path.isdir(datapath+x)]
|
||||||
|
path_to_csv = (
|
||||||
|
'/').join(foldernames[0].split('/')[:-2]) + '/order_meta.csv'
|
||||||
meta_id = read_csv(path_to_csv)
|
meta_id = read_csv(path_to_csv)
|
||||||
meta_id['recording'] = meta_id['recording'].str[1:-1]
|
meta_id['recording'] = meta_id['recording'].str[1:-1]
|
||||||
|
|
||||||
@ -61,24 +63,32 @@ def main(datapath: str):
|
|||||||
chirps_winner.append(chirp_winner)
|
chirps_winner.append(chirp_winner)
|
||||||
chirps_loser.append(chirp_loser)
|
chirps_loser.append(chirp_loser)
|
||||||
|
|
||||||
|
|
||||||
fish1_id = all_fish_ids[0]
|
fish1_id = all_fish_ids[0]
|
||||||
fish2_id = all_fish_ids[1]
|
fish2_id = all_fish_ids[1]
|
||||||
print(winner_fish_id)
|
print(winner_fish_id)
|
||||||
print(all_fish_ids)
|
print(all_fish_ids)
|
||||||
|
|
||||||
|
|
||||||
fig, ax = plt.subplots()
|
fig, ax = plt.subplots()
|
||||||
ax.boxplot([chirps_winner, chirps_loser], showfliers=False)
|
bplot1 = ax.boxplot(chirps_winner, positions=[
|
||||||
ax.scatter(np.ones(len(chirps_winner)), chirps_winner, color='r')
|
1], showfliers=False, patch_artist=True)
|
||||||
ax.scatter(np.ones(len(chirps_loser))*2, chirps_loser, color='r')
|
bplot2 = ax.boxplot(chirps_loser, positions=[
|
||||||
|
2], showfliers=False, patch_artist=True)
|
||||||
|
ax.scatter(np.ones(len(chirps_winner))*1.15, chirps_winner, color='r')
|
||||||
|
ax.scatter(np.ones(len(chirps_loser))*1.85, chirps_loser, color='r')
|
||||||
ax.set_xticklabels(['winner', 'loser'])
|
ax.set_xticklabels(['winner', 'loser'])
|
||||||
|
|
||||||
for w, l in zip(chirps_winner, chirps_loser):
|
for w, l in zip(chirps_winner, chirps_loser):
|
||||||
ax.plot([1,2], [w,l], color='r', alpha=0.5, linewidth=0.5)
|
ax.plot([1.15, 1.85], [w, l], color='r', alpha=0.5, linewidth=0.5)
|
||||||
|
|
||||||
|
colors1 = ps.red
|
||||||
|
ps.set_boxplot_color(bplot1, colors1)
|
||||||
|
colors1 = ps.orange
|
||||||
|
ps.set_boxplot_color(bplot2, colors1)
|
||||||
|
|
||||||
ax.set_ylabel('Chirpscounts [n]')
|
ax.set_ylabel('Chirpscounts [n]')
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
# Path to the data
|
# Path to the data
|
||||||
|
Loading…
Reference in New Issue
Block a user