Skip to content

Commit

Permalink
styling
Browse files Browse the repository at this point in the history
  • Loading branch information
mattijn committed Jan 18, 2025
1 parent 66c4f81 commit 1d01fa0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
26 changes: 13 additions & 13 deletions tests/examples_arguments_syntax/deviation_ellipses.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@
from vega_datasets import data


def confidence_region_2d(
arr: np.ndarray[tuple[int, int], np.dtype[np.float64]],
conf_level: float = 0.95,
segments: int = 50,
):
def confidence_region_2d(arr, conf_level=0.95, segments=50):
"""
Calculate confidence interval ellipse.
Expand Down Expand Up @@ -54,9 +50,7 @@ def confidence_region_2d(
return center + radius * (circle @ np.linalg.cholesky(cov_mat).T)


def grouped_confidence_regions(
df: pd.DataFrame, col_x: str, col_y: str, col_group: str
) -> pd.DataFrame:
def grouped_confidence_regions(df, col_x, col_y, col_group):
cols = [col_x, col_y]
ellipses = []
ser: pd.Series[float] = df[col_group]
Expand All @@ -71,17 +65,23 @@ def grouped_confidence_regions(
col_x = "petalLength"
col_y = "petalWidth"
col_group = "species"

x = alt.X(col_x, scale=alt.Scale(zero=False))
y = alt.Y(col_y, scale=alt.Scale(zero=False))
color = alt.Color(col_group)

source = data.iris()
ellipse = grouped_confidence_regions(source, col_x=col_x, col_y=col_y, col_group=col_group)
points = alt.Chart(source).mark_circle(size=50, tooltip=True).encode(x, y, color)
lines = (
alt.Chart(ellipse)
.mark_line(filled=True, fillOpacity=0.2)
.encode(x, y, color, order="order")
points = alt.Chart(source).mark_circle(size=50, tooltip=True).encode(
x=x,
y=y,
color=color
)
lines = alt.Chart(ellipse).mark_line(filled=True, fillOpacity=0.2).encode(
x=x,
y=y,
color=color,
order="order"
)

chart = (lines + points).properties(height=500, width=500)
Expand Down
26 changes: 13 additions & 13 deletions tests/examples_methods_syntax/deviation_ellipses.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@
from vega_datasets import data


def confidence_region_2d(
arr: np.ndarray[tuple[int, int], np.dtype[np.float64]],
conf_level: float = 0.95,
segments: int = 50,
):
def confidence_region_2d(arr, conf_level=0.95, segments=50):
"""
Calculate confidence interval ellipse.
Expand Down Expand Up @@ -54,9 +50,7 @@ def confidence_region_2d(
return center + radius * (circle @ np.linalg.cholesky(cov_mat).T)


def grouped_confidence_regions(
df: pd.DataFrame, col_x: str, col_y: str, col_group: str
) -> pd.DataFrame:
def grouped_confidence_regions(df, col_x, col_y, col_group):
cols = [col_x, col_y]
ellipses = []
ser: pd.Series[float] = df[col_group]
Expand All @@ -71,17 +65,23 @@ def grouped_confidence_regions(
col_x = "petalLength"
col_y = "petalWidth"
col_group = "species"

x = alt.X(col_x).scale(zero=False)
y = alt.Y(col_y).scale(zero=False)
color = alt.Color(col_group)

source = data.iris()
ellipse = grouped_confidence_regions(source, col_x=col_x, col_y=col_y, col_group=col_group)
points = alt.Chart(source).mark_circle(size=50, tooltip=True).encode(x, y, color)
lines = (
alt.Chart(ellipse)
.mark_line(filled=True, fillOpacity=0.2)
.encode(x, y, color, order="order")
points = alt.Chart(source).mark_circle(size=50, tooltip=True).encode(
x=x,
y=y,
color=color
)
lines = alt.Chart(ellipse).mark_line(filled=True, fillOpacity=0.2).encode(
x=x,
y=y,
color=color,
order="order"
)

chart = (lines + points).properties(height=500, width=500)
Expand Down

0 comments on commit 1d01fa0

Please sign in to comment.