Skip to content
Snippets Groups Projects
Commit 2f3f5568 authored by lukas leufen's avatar lukas leufen
Browse files

Merge branch 'lukas_issue427_feat_mse-line-plot' into 'develop'

just first skeleton for mse line plot

See merge request !487
parents cb3248d6 795c6ab4
No related branches found
No related tags found
3 merge requests!500Develop,!499Resolve "release v2.3.0",!487just first skeleton for mse line plot
Pipeline #112150 passed
...@@ -11,7 +11,7 @@ packaging==21.3 ...@@ -11,7 +11,7 @@ packaging==21.3
timezonefinder==5.2.0 timezonefinder==5.2.0
patsy==0.5.2 patsy==0.5.2
statsmodels==0.13.2 statsmodels==0.13.2
seaborn==0.11.2 seaborn==0.12.0
xarray==0.16.2 xarray==0.16.2
tabulate==0.8.10 tabulate==0.8.10
wget==3.2 wget==3.2
......
...@@ -11,7 +11,7 @@ packaging==21.3 ...@@ -11,7 +11,7 @@ packaging==21.3
timezonefinder==5.2.0 timezonefinder==5.2.0
patsy==0.5.2 patsy==0.5.2
statsmodels==0.13.2 statsmodels==0.13.2
seaborn==0.11.2 seaborn==0.12.0
xarray==0.16.2 xarray==0.16.2
tabulate==0.8.10 tabulate==0.8.10
wget==3.2 wget==3.2
......
...@@ -17,6 +17,7 @@ import seaborn as sns ...@@ -17,6 +17,7 @@ import seaborn as sns
import xarray as xr import xarray as xr
from matplotlib.backends.backend_pdf import PdfPages from matplotlib.backends.backend_pdf import PdfPages
from matplotlib.offsetbox import AnchoredText from matplotlib.offsetbox import AnchoredText
import matplotlib.dates as mdates
from scipy.stats import mannwhitneyu from scipy.stats import mannwhitneyu
from mlair import helpers from mlair import helpers
...@@ -1313,6 +1314,12 @@ class PlotTimeEvolutionMetric(AbstractPlotClass): ...@@ -1313,6 +1314,12 @@ class PlotTimeEvolutionMetric(AbstractPlotClass):
self.plot_name = f"{plot_name}_summary" self.plot_name = f"{plot_name}_summary"
self._plot(plot_data, years, months, vmin, vmax, None) self._plot(plot_data, years, months, vmin, vmax, None)
# line plot version
y_dim = "error"
plot_data = data.to_dataset(name=y_dim).to_dataframe().reset_index()
self.plot_name = f"{plot_name}_line_plot"
self._plot_summary_line(plot_data, x_dim=time_dim, y_dim=y_dim, hue_dim=model_type_dim)
@staticmethod @staticmethod
def _find_nan_edge(data, time_dim): def _find_nan_edge(data, time_dim):
coll = [] coll = []
...@@ -1369,6 +1376,20 @@ class PlotTimeEvolutionMetric(AbstractPlotClass): ...@@ -1369,6 +1376,20 @@ class PlotTimeEvolutionMetric(AbstractPlotClass):
plt.tight_layout() plt.tight_layout()
self._save() self._save()
def _plot_summary_line(self, data, x_dim, y_dim, hue_dim):
data[x_dim] = pd.to_datetime(data[x_dim].dt.strftime('%Y-%m')) #???
n = len(data[hue_dim].unique())
ax = sns.lineplot(data=data, x=x_dim, y=y_dim, hue=hue_dim, errorbar=("sd", 1),
palette=sns.color_palette()[:n], style=hue_dim, dashes=False, markers=["X"]*n)
ax.set(xlabel=None, ylabel=self.title)
ax.get_legend().set_title(None)
ax.xaxis.set_major_locator(mdates.YearLocator())
ax.xaxis.set_major_formatter(mdates.DateFormatter('%b\n%Y'))
ax.xaxis.set_minor_locator(mdates.MonthLocator(bymonth=range(1, 13, 3)))
ax.xaxis.set_minor_formatter(mdates.DateFormatter('%b'))
plt.tight_layout()
self._save()
@TimeTrackingWrapper @TimeTrackingWrapper
class PlotSeasonalMSEStack(AbstractPlotClass): class PlotSeasonalMSEStack(AbstractPlotClass):
......
...@@ -20,7 +20,7 @@ pytest-html==3.1.1 ...@@ -20,7 +20,7 @@ pytest-html==3.1.1
pytest-lazy-fixture==0.6.3 pytest-lazy-fixture==0.6.3
requests==2.28.1 requests==2.28.1
scipy==1.7.1 scipy==1.7.1
seaborn==0.11.2 seaborn==0.12.0
setuptools==47.1.0 setuptools==47.1.0
--no-binary shapely Shapely==1.8.0 --no-binary shapely Shapely==1.8.0
six==1.15.0 six==1.15.0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment