Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gridlines automatically created in matplotlib and seaborn plots [BUG] #2380

Open
ETTAN93 opened this issue May 10, 2024 · 2 comments
Open

Gridlines automatically created in matplotlib and seaborn plots [BUG] #2380

ETTAN93 opened this issue May 10, 2024 · 2 comments
Labels
good first issue Good for newcomers improvement New feature or improvement

Comments

@ETTAN93
Copy link

ETTAN93 commented May 10, 2024

Darts package seems to have some parameter under the hood that inserts gridlines into every matplotlib and seaborn plot:

If i do not import darts, this seaborn heatmap doesnt show gridlines,

import seaborn as sns
import numpy as np
from lib.data_ingestion.general_utils import pickle_file, load_pickle_file

combined_park_df = load_pickle_file(f'pickle_files/balti2_preprocessed_df.pkl')

overall_corr = combined_park_df[['edm_power_feed_in', 'edm_p_mw', 'power_diff']].corr()
matrix = np.triu(overall_corr)
sns.heatmap(overall_corr, annot = True)

image

However, if I include darts import as part of the imports, gridlines will appear in the plot:

import seaborn as sns
import numpy as np
from lib.data_ingestion.general_utils import pickle_file, load_pickle_file
import darts 

combined_park_df = load_pickle_file(f'pickle_files/balti2_preprocessed_df.pkl')

overall_corr = combined_park_df[['edm_power_feed_in', 'edm_p_mw', 'power_diff']].corr()
matrix = np.triu(overall_corr)
sns.heatmap(overall_corr, annot = True)

image

Is there a reason why it's implemented this way?

@ETTAN93 ETTAN93 added bug Something isn't working triage Issue waiting for triaging labels May 10, 2024
@dennisbader
Copy link
Collaborator

dennisbader commented May 13, 2024

Hi @ETTAN93, when importing anything from Darts, we change the matplotlib settings/style for plotting.
You can deactivate this with environment variable "DARTS_CONFIGURE_MATPLOTLIB"] = "0".

Like below

import os

os.environ["DARTS_CONFIGURE_MATPLOTLIB"] = "0"

import darts

import matplotlib.pyplot as plt
import seaborn as sns

iris = sns.load_dataset('iris')

overall_corr = iris[iris.columns[:4]].corr()
sns.heatmap(overall_corr, annot=True)
plt.show()

There were already some discussion about not changing the style by default (see #924). Maybe we should apply this at some point.

@madtoinou what do you think about this?

@madtoinou
Copy link
Collaborator

I agree that not changing the global config would be better, especially if users use Darts in the context of large projects in combination with other plotting libraries.

@madtoinou madtoinou added good first issue Good for newcomers improvement New feature or improvement and removed bug Something isn't working triage Issue waiting for triaging labels May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers improvement New feature or improvement
Projects
None yet
Development

No branches or pull requests

3 participants