Skip to content

Commit f7d537c

Browse files
use legend titles in PX
1 parent 872dfba commit f7d537c

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

doc/python/plotly-express.md

+4-5
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ jupyter:
55
text_representation:
66
extension: .md
77
format_name: markdown
8-
format_version: "1.1"
9-
jupytext_version: 1.1.1
8+
format_version: '1.2'
9+
jupytext_version: 1.3.1
1010
kernelspec:
1111
display_name: Python 3
1212
language: python
@@ -20,10 +20,9 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.7.3
23+
version: 3.6.8
2424
plotly:
25-
description:
26-
Plotly Express is a terse, consistent, high-level API for rapid data
25+
description: Plotly Express is a terse, consistent, high-level API for rapid data
2726
exploration and figure generation.
2827
display_as: file_settings
2928
language: python

packages/python/plotly/plotly/express/_core.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1197,7 +1197,7 @@ def make_figure(args, constructor, trace_patch={}, layout_patch={}):
11971197
trace_name_labels[key] = str(val)
11981198
if m.variable == "animation_frame":
11991199
frame_name = val
1200-
trace_name = ", ".join(k + "=" + v for k, v in trace_name_labels.items())
1200+
trace_name = ", ".join(trace_name_labels.values())
12011201
if frame_name not in trace_names_by_frame:
12021202
trace_names_by_frame[frame_name] = set()
12031203
trace_names = trace_names_by_frame[frame_name]
@@ -1346,7 +1346,7 @@ def make_figure(args, constructor, trace_patch={}, layout_patch={}):
13461346
for v in ["title", "height", "width"]:
13471347
if args[v]:
13481348
layout_patch[v] = args[v]
1349-
layout_patch["legend"] = {"tracegroupgap": 0}
1349+
layout_patch["legend"] = dict(tracegroupgap=0, title=", ".join(trace_name_labels))
13501350
if "title" not in layout_patch and args["template"].layout.margin.t is None:
13511351
layout_patch["margin"] = {"t": 60}
13521352
if (

0 commit comments

Comments
 (0)