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

Fix dynamic reports with bokeh 3.4.0 problems #1068

Merged
merged 2 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ classifiers = [
license = {file = "LICENSE"}
requires-python = ">=3.8"
dependencies = [
"bokeh",
"bokeh>=1.0.0,<=3.4.0",
"mapca>=0.0.4,<=0.0.5",
"matplotlib",
"nibabel>=2.5.1,<=5.2.1",
Expand Down
37 changes: 24 additions & 13 deletions tedana/reporting/dynamic_figures.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,20 @@ def _create_kr_plt(comptable_cds, kappa_elbow=None, rho_elbow=None):
("Tags", "@classtag"),
]
)

fig = plotting.figure(
width=400,
height=400,
tools=["tap,wheel_zoom,reset,pan,crosshair,save", kr_hovertool],
tools=[
"wheel_zoom,reset,pan,crosshair,save",
models.TapTool(mode="replace"),
kr_hovertool,
],
title="Kappa / Rho Plot",
)
diagonal = models.Slope(gradient=1, y_intercept=0, line_color="#D3D3D3")
fig.add_layout(diagonal)
fig.circle(
fig.scatter(
"kappa",
"rho",
size="size",
Expand Down Expand Up @@ -279,15 +284,15 @@ def _create_sorted_plt(
fig = plotting.figure(
width=400,
height=400,
tools=["tap,wheel_zoom,reset,pan,crosshair,save", hovertool],
tools=["wheel_zoom,reset,pan,crosshair,save", models.TapTool(mode="replace"), hovertool],
title=title,
)
fig.line(
x=np.arange(1, n_comps + 1),
y=comptable_cds.data[y_var].sort_values(ascending=False).values,
color="black",
)
fig.circle(x_var, y_var, source=comptable_cds, size=5, color="color", alpha=0.7)
fig.scatter(x_var, y_var, source=comptable_cds, size=5, color="color", alpha=0.7)
fig.xaxis.axis_label = x_label
fig.yaxis.axis_label = y_label
fig.x_range = models.Range1d(-1, n_comps + 1)
Expand Down Expand Up @@ -319,18 +324,22 @@ def _create_sorted_plt(


def _create_varexp_pie_plt(comptable_cds):
fig = plotting.figure(
width=400,
height=400,
title="Variance Explained View",
tools=["hover,tap,save"],

pie_hovertool = models.HoverTool(
tooltips=[
("Component ID", " @component"),
("Component ID", "@component"),
("Kappa", "@kappa{0.00}"),
("Rho", "@rho{0.00}"),
("Var. Exp.", "@varexp{0.00}%"),
("Var. Expl.", "@varexp{0.00}%"),
("Tags", "@classtag"),
],
]
)

fig = plotting.figure(
width=400,
height=400,
title="Variance Explained View",
tools=[pie_hovertool, models.TapTool(mode="replace"), "save"],
)
fig.wedge(
x=0,
Expand All @@ -347,7 +356,9 @@ def _create_varexp_pie_plt(comptable_cds):
fig.grid.visible = False
fig.toolbar.logo = None

circle = models.Circle(x=0, y=1, size=150, fill_color="white", line_color="white")
circle = models.Scatter(
x=0, y=1, size=150, marker="circle", fill_color="white", line_color="white"
)
fig.add_glyph(circle)

return fig
Expand Down