Skip to content

Commit

Permalink
💄 Improve default chart view
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahker committed Jul 11, 2023
1 parent 3b697ef commit e25c3cb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
3 changes: 3 additions & 0 deletions callbacks/image_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ def render_image(
dragmode="pan",
height=620,
width=620,
paper_bgcolor="rgba(0,0,0,0)",
plot_bgcolor="rgba(0,0,0,0)",
)
fig.update_traces(hovertemplate=None, hoverinfo="skip")

# set the default annotation style
hex_color = dmc.theme.DEFAULT_COLORS[annotation_color][7]
Expand Down
5 changes: 4 additions & 1 deletion components/image_viewer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from dash import html, dcc
import dash_mantine_components as dmc
from dash_iconify import DashIconify
from utils.plot_utils import blank_fig

COMPONENT_STYLE = {
"width": "640px",
Expand Down Expand Up @@ -85,7 +86,9 @@ def layout():
color=dmc.theme.DEFAULT_COLORS["blue"][6], variant="bars"
),
children=[
dcc.Graph(id="image-viewer", config=FIGURE_CONFIG),
dcc.Graph(
id="image-viewer", config=FIGURE_CONFIG, figure=blank_fig()
),
],
),
],
Expand Down
10 changes: 10 additions & 0 deletions utils/plot_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import plotly.graph_objects as go


def blank_fig():
fig = go.Figure(go.Scatter(x=[], y=[]))
fig.update_layout(template=None)
fig.update_xaxes(showgrid=False, showticklabels=False, zeroline=False)
fig.update_yaxes(showgrid=False, showticklabels=False, zeroline=False)

return fig

0 comments on commit e25c3cb

Please sign in to comment.