1
1
import pathlib
2
- from typing import List , Union
2
+ from typing import List , Optional , Union
3
3
4
4
import matplotlib
5
5
import matplotlib .pyplot as plt
@@ -25,8 +25,8 @@ def _violinplot(
25
25
self ,
26
26
data : dataType ,
27
27
names : namesType ,
28
- title : titleType = None ,
29
- ax : matplotlib .axes .SubplotBase = None ,
28
+ title : Optional [ titleType ] = None ,
29
+ ax : Optional [ matplotlib .axes .Axes ] = None ,
30
30
) -> matplotlib .figure .Figure :
31
31
"""For making violinplots."""
32
32
@@ -76,7 +76,7 @@ def _boxplot_xticks_labels(self):
76
76
return [str (n ) for n in self .result_set .ranked_names ]
77
77
78
78
def boxplot (
79
- self , title : titleType = None , ax : matplotlib .axes .SubplotBase = None
79
+ self , title : Optional [ titleType ] = None , ax : Optional [ matplotlib .axes .Axes ] = None
80
80
) -> matplotlib .figure .Figure :
81
81
"""For the specific mean score boxplot."""
82
82
data = self ._boxplot_dataset
@@ -98,7 +98,7 @@ def _winplot_dataset(self):
98
98
return wins , ranked_names
99
99
100
100
def winplot (
101
- self , title : titleType = None , ax : matplotlib .axes .SubplotBase = None
101
+ self , title : Optional [ titleType ] = None , ax : Optional [ matplotlib .axes .Axes ] = None
102
102
) -> matplotlib .figure .Figure :
103
103
"""Plots the distributions for the number of wins for each strategy."""
104
104
@@ -126,7 +126,7 @@ def _sdv_plot_dataset(self):
126
126
return diffs , ranked_names
127
127
128
128
def sdvplot (
129
- self , title : titleType = None , ax : matplotlib .axes .SubplotBase = None
129
+ self , title : Optional [ titleType ] = None , ax : Optional [ matplotlib .axes .Axes ] = None
130
130
) -> matplotlib .figure .Figure :
131
131
"""Score difference violin plots to visualize the distributions of how
132
132
players attain their payoffs."""
@@ -143,7 +143,7 @@ def _lengthplot_dataset(self):
143
143
]
144
144
145
145
def lengthplot (
146
- self , title : titleType = None , ax : matplotlib .axes .SubplotBase = None
146
+ self , title : Optional [ titleType ] = None , ax : Optional [ matplotlib .axes .Axes ] = None
147
147
) -> matplotlib .figure .Figure :
148
148
"""For the specific match length boxplot."""
149
149
data = self ._lengthplot_dataset
@@ -174,8 +174,8 @@ def _payoff_heatmap(
174
174
self ,
175
175
data : dataType ,
176
176
names : namesType ,
177
- title : titleType = None ,
178
- ax : matplotlib .axes .SubplotBase = None ,
177
+ title : Optional [ titleType ] = None ,
178
+ ax : Optional [ matplotlib .axes .Axes ] = None ,
179
179
cmap : str = "viridis" ,
180
180
) -> matplotlib .figure .Figure :
181
181
"""Generic heatmap plot"""
@@ -202,15 +202,15 @@ def _payoff_heatmap(
202
202
return figure
203
203
204
204
def pdplot (
205
- self , title : titleType = None , ax : matplotlib .axes .SubplotBase = None
205
+ self , title : Optional [ titleType ] = None , ax : Optional [ matplotlib .axes .Axes ] = None
206
206
) -> matplotlib .figure .Figure :
207
207
"""Payoff difference heatmap to visualize the distributions of how
208
208
players attain their payoffs."""
209
209
matrix , names = self ._pdplot_dataset
210
210
return self ._payoff_heatmap (matrix , names , title = title , ax = ax )
211
211
212
212
def payoff (
213
- self , title : titleType = None , ax : matplotlib .axes .SubplotBase = None
213
+ self , title : Optional [ titleType ] = None , ax : Optional [ matplotlib .axes .Axes ] = None
214
214
) -> matplotlib .figure .Figure :
215
215
"""Payoff heatmap to visualize the distributions of how
216
216
players attain their payoffs."""
@@ -223,9 +223,9 @@ def payoff(
223
223
def stackplot (
224
224
self ,
225
225
eco ,
226
- title : titleType = None ,
226
+ title : Optional [ titleType ] = None ,
227
227
logscale : bool = True ,
228
- ax : matplotlib .axes .SubplotBase = None ,
228
+ ax : Optional [ matplotlib .axes .Axes ] = None ,
229
229
) -> matplotlib .figure .Figure :
230
230
231
231
populations = eco .population_sizes
0 commit comments