Skip to content

Commit

Permalink
fixed a few last issues in examples picked up by ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
sepro committed May 29, 2024
1 parent 4bbddf9 commit 22c3f47
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
7 changes: 3 additions & 4 deletions example.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

from sklearn.datasets import load_iris
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
from sklearn.svm import SVC
from sklearn.ensemble import RandomForestClassifier
import pandas as pd

# Load iris dataset and convert to dataframe
Expand All @@ -16,7 +19,6 @@
plt.show()

# Key word arguments (like colormap) can be passed to the DataFrame.plot.area
from matplotlib.colors import ListedColormap

colormap = ListedColormap(["red", "green", "blue"])
loreplot(data=iris_df, x="sepal width (cm)", y="species", colormap=colormap)
Expand Down Expand Up @@ -54,9 +56,6 @@
plt.show()

# Basic Lore Plot with default style but different classifier
from sklearn.svm import SVC
from sklearn.ensemble import RandomForestClassifier

fig, ax = plt.subplots(1, 2, sharex=False, sharey=True)

svc = SVC(probability=True)
Expand Down
6 changes: 3 additions & 3 deletions example_uncertainty.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from sklearn.datasets import load_iris
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
from sklearn.svm import SVC
import pandas as pd

# Load iris dataset and convert to dataframe
Expand All @@ -27,7 +29,7 @@
plt.show()

# Uncertainty plot with custom colors
from matplotlib.colors import ListedColormap


colormap = ListedColormap(["red", "green", "blue"])
uncertainty_plot(
Expand All @@ -54,8 +56,6 @@
plt.show()

# Uncertainty plot with a custom classifier
from sklearn.svm import SVC

svc = SVC(probability=True)

uncertainty_plot(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_loreplot_default():


# Test case for loreplot with confounder
def test_loreplot_default():
def test_loreplot_confounder():
loreplot(
df, "x", "y", confounders=[("z", 1)]
) # first test without specifying the axis
Expand Down

0 comments on commit 22c3f47

Please sign in to comment.