Skip to content

Commit d49d274

Browse files
ability to show markers on lines
1 parent e16ba24 commit d49d274

File tree

3 files changed

+46
-5
lines changed

3 files changed

+46
-5
lines changed

packages/python/plotly/plotly/express/_chart_types.py

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,9 @@ def density_heatmap(
202202
z=[
203203
"For `density_heatmap` and `density_contour` these values are used as the inputs to `histfunc`.",
204204
],
205-
histfunc=["The arguments to this function are the values of `z`.",],
205+
histfunc=[
206+
"The arguments to this function are the values of `z`.",
207+
],
206208
),
207209
)
208210

@@ -214,6 +216,7 @@ def line(
214216
line_group=None,
215217
color=None,
216218
line_dash=None,
219+
symbol=None,
217220
hover_name=None,
218221
hover_data=None,
219222
custom_data=None,
@@ -236,6 +239,9 @@ def line(
236239
color_discrete_map=None,
237240
line_dash_sequence=None,
238241
line_dash_map=None,
242+
symbol_sequence=None,
243+
symbol_map=None,
244+
markers=False,
239245
log_x=False,
240246
log_y=False,
241247
range_x=None,
@@ -263,6 +269,7 @@ def area(
263269
y=None,
264270
line_group=None,
265271
color=None,
272+
symbol=None,
266273
hover_name=None,
267274
hover_data=None,
268275
custom_data=None,
@@ -278,6 +285,9 @@ def area(
278285
labels=None,
279286
color_discrete_sequence=None,
280287
color_discrete_map=None,
288+
symbol_sequence=None,
289+
symbol_map=None,
290+
markers=False,
281291
orientation=None,
282292
groupnorm=None,
283293
log_x=False,
@@ -459,7 +469,9 @@ def histogram(
459469
args=locals(),
460470
constructor=go.Histogram,
461471
trace_patch=dict(
462-
histnorm=histnorm, histfunc=histfunc, cumulative=dict(enabled=cumulative),
472+
histnorm=histnorm,
473+
histfunc=histfunc,
474+
cumulative=dict(enabled=cumulative),
463475
),
464476
layout_patch=dict(barmode=barmode, barnorm=barnorm),
465477
)
@@ -519,7 +531,11 @@ def violin(
519531
args=locals(),
520532
constructor=go.Violin,
521533
trace_patch=dict(
522-
points=points, box=dict(visible=box), scalegroup=True, x0=" ", y0=" ",
534+
points=points,
535+
box=dict(visible=box),
536+
scalegroup=True,
537+
x0=" ",
538+
y0=" ",
523539
),
524540
layout_patch=dict(violinmode=violinmode),
525541
)
@@ -694,6 +710,7 @@ def line_3d(
694710
line_dash=None,
695711
text=None,
696712
line_group=None,
713+
symbol=None,
697714
hover_name=None,
698715
hover_data=None,
699716
custom_data=None,
@@ -711,6 +728,9 @@ def line_3d(
711728
color_discrete_map=None,
712729
line_dash_sequence=None,
713730
line_dash_map=None,
731+
symbol_sequence=None,
732+
symbol_map=None,
733+
markers=False,
714734
log_x=False,
715735
log_y=False,
716736
log_z=False,
@@ -780,6 +800,7 @@ def line_ternary(
780800
color=None,
781801
line_dash=None,
782802
line_group=None,
803+
symbol=None,
783804
hover_name=None,
784805
hover_data=None,
785806
custom_data=None,
@@ -792,6 +813,9 @@ def line_ternary(
792813
color_discrete_map=None,
793814
line_dash_sequence=None,
794815
line_dash_map=None,
816+
symbol_sequence=None,
817+
symbol_map=None,
818+
markers=False,
795819
line_shape=None,
796820
title=None,
797821
template=None,
@@ -864,6 +888,7 @@ def line_polar(
864888
custom_data=None,
865889
line_group=None,
866890
text=None,
891+
symbol=None,
867892
animation_frame=None,
868893
animation_group=None,
869894
category_orders=None,
@@ -872,6 +897,9 @@ def line_polar(
872897
color_discrete_map=None,
873898
line_dash_sequence=None,
874899
line_dash_map=None,
900+
symbol_sequence=None,
901+
symbol_map=None,
902+
markers=False,
875903
direction="clockwise",
876904
start_angle=90,
877905
line_close=False,
@@ -1069,6 +1097,7 @@ def line_geo(
10691097
hover_data=None,
10701098
custom_data=None,
10711099
line_group=None,
1100+
symbol=None,
10721101
animation_frame=None,
10731102
animation_group=None,
10741103
category_orders=None,
@@ -1077,6 +1106,9 @@ def line_geo(
10771106
color_discrete_map=None,
10781107
line_dash_sequence=None,
10791108
line_dash_map=None,
1109+
symbol_sequence=None,
1110+
symbol_map=None,
1111+
markers=False,
10801112
projection=None,
10811113
scope=None,
10821114
center=None,

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1773,8 +1773,13 @@ def infer_config(args, constructor, trace_patch, layout_patch):
17731773
trace_patch["opacity"] = args["opacity"]
17741774
else:
17751775
trace_patch["marker"] = dict(opacity=args["opacity"])
1776-
if "line_group" in args:
1777-
trace_patch["mode"] = "lines" + ("+markers+text" if args["text"] else "")
1776+
if "line_group" in args: # px.line, px.line_*, px.area
1777+
modes = set(["lines"])
1778+
if args.get("text") or args.get("symbol") or args.get("markers"):
1779+
modes.add("markers")
1780+
if args.get("text"):
1781+
modes.add("text")
1782+
trace_patch["mode"] = "+".join(modes)
17781783
elif constructor != go.Splom and (
17791784
"symbol" in args or constructor == go.Scattermapbox
17801785
):

packages/python/plotly/plotly/express/_doc.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,10 @@
325325
"Setting this value is recommended when using `plotly.express.colors.diverging` color scales as the inputs to `color_continuous_scale`.",
326326
],
327327
size_max=["int (default `20`)", "Set the maximum mark size when using `size`."],
328+
markers=[
329+
"boolean (default `False`)",
330+
"If `True`, markers are shown on lines.",
331+
],
328332
log_x=[
329333
"boolean (default `False`)",
330334
"If `True`, the x-axis is log-scaled in cartesian coordinates.",

0 commit comments

Comments
 (0)