diff --git a/copulogram/Copulogram.py b/copulogram/Copulogram.py index 7e67154..60941b8 100644 --- a/copulogram/Copulogram.py +++ b/copulogram/Copulogram.py @@ -112,7 +112,10 @@ def draw(self, if quantile_contour_levels is None: copulogram.map_lower(plt.scatter, color=color, alpha=alpha, marker=marker) - temp = df_numeric.rank() / self.N * df_numeric.max().values + temp = (df_numeric.rank() / self.N) + xmaxs = df_numeric.max().values + xmins = df_numeric.min().values + temp = temp * (xmaxs - xmins) + xmins copulogram.data = temp copulogram = copulogram.map_upper(plt.scatter, color=color, alpha=alpha, marker=marker) else: @@ -140,7 +143,11 @@ def draw(self, if quantile_contour_levels is None: copulogram.map_lower(sns.scatterplot, alpha=alpha, marker=marker) - temp = df_numeric[plotted_cols].rank() / self.N * df_numeric[plotted_cols].max().values + #temp = df_numeric[plotted_cols].rank() / self.N * df_numeric[plotted_cols].max().values + temp = (df_numeric[plotted_cols].rank() / self.N) + xmaxs = df_numeric[plotted_cols].max().values + xmins = df_numeric[plotted_cols].min().values + temp = temp * (xmaxs - xmins) + xmins temp[hue] = df[hue] copulogram.data = temp copulogram = copulogram.map_upper(sns.scatterplot, alpha=alpha, marker=marker) diff --git a/examples/figures/ishigami.jpg b/examples/figures/ishigami.jpg new file mode 100644 index 0000000..a18e8d2 Binary files /dev/null and b/examples/figures/ishigami.jpg differ diff --git a/examples/figures/wind_waves.jpg b/examples/figures/wind_waves.jpg index 73f14f0..96427b9 100644 Binary files a/examples/figures/wind_waves.jpg and b/examples/figures/wind_waves.jpg differ diff --git a/examples/figures/wind_waves_contours.jpg b/examples/figures/wind_waves_contours.jpg index a5bb156..9cf952b 100644 Binary files a/examples/figures/wind_waves_contours.jpg and b/examples/figures/wind_waves_contours.jpg differ diff --git a/examples/figures/wind_waves_woutput.jpg b/examples/figures/wind_waves_woutput.jpg index c922c16..172549b 100644 Binary files a/examples/figures/wind_waves_woutput.jpg and b/examples/figures/wind_waves_woutput.jpg differ diff --git a/examples/ishigami.py b/examples/ishigami.py new file mode 100644 index 0000000..67675df --- /dev/null +++ b/examples/ishigami.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +Copyright (C) EDF 2023 + +@author: Elias Fekhari +""" +import numpy as np +import pandas as pd +import openturns as ot +import copulogram as cp +from openturns.usecases import ishigami_function + +im = ishigami_function.IshigamiModel() +size = 5000 +X = im.distributionX.getSample(size) +Y = im.model(X) + +plotting_size = 1000 +data = pd.DataFrame(np.array(X[:plotting_size]), columns=list(X.getDescription())) +data['Y'] = np.array(Y[:plotting_size]) +copulogram = cp.Copulogram(data) +copulogram.draw(color='C7', marker='.', alpha=0.5, save_file="figures/ishigami.jpg")