Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8b4f17d

Browse files
authored
Fix markers legend not being suppressible (#789)
* fix markers showlegend * add test * pylint
1 parent 4ebdc96 commit 8b4f17d

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

magpylib/_src/display/traces_generic.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ def get_trace(self, **kwargs):
6363
"y": y,
6464
"z": z,
6565
"mode": "markers",
66+
"showlegend": style.legend.show, # pylint: disable=no-member
6667
**marker_kwargs,
6768
**kwargs,
6869
}

tests/test_display_plotly.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,3 +383,13 @@ def test_legends():
383383
)
384384
assert [t.name for t in fig.data] == ["Plotly extra trace (1m|1m|1m)"] * 4
385385
assert [t.showlegend for t in fig.data] == [True, False, False, False]
386+
387+
fig = magpy.show(
388+
markers=[(0, 0, 0)],
389+
backend="plotly",
390+
style_legend_show=False,
391+
return_fig=True,
392+
)
393+
394+
assert [t.name for t in fig.data] == ["Marker"]
395+
assert [t.showlegend for t in fig.data] == [False]

0 commit comments

Comments
 (0)