Skip to content

Commit b5c6fb4

Browse files
Fix ruff linting violations in plotly bar-basic implementation (#136)
Ruff reported 12 C408 violations (unnecessary `dict()` calls) in the plotly bar-basic implementation that needed to be converted to dictionary literals. **Changes:** - Replaced all `dict()` constructor calls with dictionary literal syntax in `plots/plotly/bar/bar-basic/default.py` **Example:** ```python # Before marker=dict(color=color, opacity=alpha, line=dict(color=edgecolor, width=1)) # After marker={"color": color, "opacity": alpha, "line": {"color": edgecolor, "width": 1}} ``` All ruff checks now pass. <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/MarkusNeusinger/pyplots/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: MarkusNeusinger <2921697+MarkusNeusinger@users.noreply.github.com>
1 parent fa71ad0 commit b5c6fb4

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

plots/plotly/bar/bar-basic/default.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,28 +84,28 @@ def create_plot(
8484
go.Bar(
8585
x=data[category],
8686
y=data[value],
87-
marker=dict(color=color, opacity=alpha, line=dict(color=edgecolor, width=1)),
87+
marker={"color": color, "opacity": alpha, "line": {"color": edgecolor, "width": 1}},
8888
**kwargs,
8989
)
9090
)
9191

9292
# Update layout with styling
9393
fig.update_layout(
94-
title=dict(text=title, x=0.5, xanchor="center") if title else None,
95-
xaxis=dict(title=dict(text=x_label, font=dict(size=14)), tickangle=-rotation, tickfont=dict(size=12)),
96-
yaxis=dict(
97-
title=dict(text=y_label, font=dict(size=14)),
98-
tickfont=dict(size=12),
99-
rangemode="tozero",
100-
showgrid=True,
101-
gridwidth=1,
102-
gridcolor="rgba(128, 128, 128, 0.3)",
103-
),
94+
title={"text": title, "x": 0.5, "xanchor": "center"} if title else None,
95+
xaxis={"title": {"text": x_label, "font": {"size": 14}}, "tickangle": -rotation, "tickfont": {"size": 12}},
96+
yaxis={
97+
"title": {"text": y_label, "font": {"size": 14}},
98+
"tickfont": {"size": 12},
99+
"rangemode": "tozero",
100+
"showgrid": True,
101+
"gridwidth": 1,
102+
"gridcolor": "rgba(128, 128, 128, 0.3)",
103+
},
104104
template="plotly_white",
105105
width=figsize[0],
106106
height=figsize[1],
107107
showlegend=False,
108-
margin=dict(l=80, r=40, t=80 if title else 40, b=80),
108+
margin={"l": 80, "r": 40, "t": 80 if title else 40, "b": 80},
109109
)
110110

111111
return fig

0 commit comments

Comments
 (0)