Skip to content

Commit f680f80

Browse files
ability to show markers on lines
1 parent ce1bf36 commit f680f80

File tree

3 files changed

+46
-5
lines changed

3 files changed

+46
-5
lines changed

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

+35-3
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,9 @@ def density_heatmap(
200200
z=[
201201
"For `density_heatmap` and `density_contour` these values are used as the inputs to `histfunc`.",
202202
],
203-
histfunc=["The arguments to this function are the values of `z`.",],
203+
histfunc=[
204+
"The arguments to this function are the values of `z`.",
205+
],
204206
),
205207
)
206208

@@ -212,6 +214,7 @@ def line(
212214
line_group=None,
213215
color=None,
214216
line_dash=None,
217+
symbol=None,
215218
hover_name=None,
216219
hover_data=None,
217220
custom_data=None,
@@ -234,6 +237,9 @@ def line(
234237
color_discrete_map=None,
235238
line_dash_sequence=None,
236239
line_dash_map=None,
240+
symbol_sequence=None,
241+
symbol_map=None,
242+
markers=False,
237243
log_x=False,
238244
log_y=False,
239245
range_x=None,
@@ -261,6 +267,7 @@ def area(
261267
y=None,
262268
line_group=None,
263269
color=None,
270+
symbol=None,
264271
hover_name=None,
265272
hover_data=None,
266273
custom_data=None,
@@ -276,6 +283,9 @@ def area(
276283
labels=None,
277284
color_discrete_sequence=None,
278285
color_discrete_map=None,
286+
symbol_sequence=None,
287+
symbol_map=None,
288+
markers=False,
279289
orientation=None,
280290
groupnorm=None,
281291
log_x=False,
@@ -457,7 +467,9 @@ def histogram(
457467
args=locals(),
458468
constructor=go.Histogram,
459469
trace_patch=dict(
460-
histnorm=histnorm, histfunc=histfunc, cumulative=dict(enabled=cumulative),
470+
histnorm=histnorm,
471+
histfunc=histfunc,
472+
cumulative=dict(enabled=cumulative),
461473
),
462474
layout_patch=dict(barmode=barmode, barnorm=barnorm),
463475
)
@@ -517,7 +529,11 @@ def violin(
517529
args=locals(),
518530
constructor=go.Violin,
519531
trace_patch=dict(
520-
points=points, box=dict(visible=box), scalegroup=True, x0=" ", y0=" ",
532+
points=points,
533+
box=dict(visible=box),
534+
scalegroup=True,
535+
x0=" ",
536+
y0=" ",
521537
),
522538
layout_patch=dict(violinmode=violinmode),
523539
)
@@ -692,6 +708,7 @@ def line_3d(
692708
line_dash=None,
693709
text=None,
694710
line_group=None,
711+
symbol=None,
695712
hover_name=None,
696713
hover_data=None,
697714
custom_data=None,
@@ -709,6 +726,9 @@ def line_3d(
709726
color_discrete_map=None,
710727
line_dash_sequence=None,
711728
line_dash_map=None,
729+
symbol_sequence=None,
730+
symbol_map=None,
731+
markers=False,
712732
log_x=False,
713733
log_y=False,
714734
log_z=False,
@@ -778,6 +798,7 @@ def line_ternary(
778798
color=None,
779799
line_dash=None,
780800
line_group=None,
801+
symbol=None,
781802
hover_name=None,
782803
hover_data=None,
783804
custom_data=None,
@@ -790,6 +811,9 @@ def line_ternary(
790811
color_discrete_map=None,
791812
line_dash_sequence=None,
792813
line_dash_map=None,
814+
symbol_sequence=None,
815+
symbol_map=None,
816+
markers=False,
793817
line_shape=None,
794818
title=None,
795819
template=None,
@@ -862,6 +886,7 @@ def line_polar(
862886
custom_data=None,
863887
line_group=None,
864888
text=None,
889+
symbol=None,
865890
animation_frame=None,
866891
animation_group=None,
867892
category_orders=None,
@@ -870,6 +895,9 @@ def line_polar(
870895
color_discrete_map=None,
871896
line_dash_sequence=None,
872897
line_dash_map=None,
898+
symbol_sequence=None,
899+
symbol_map=None,
900+
markers=False,
873901
direction="clockwise",
874902
start_angle=90,
875903
line_close=False,
@@ -1067,6 +1095,7 @@ def line_geo(
10671095
hover_data=None,
10681096
custom_data=None,
10691097
line_group=None,
1098+
symbol=None,
10701099
animation_frame=None,
10711100
animation_group=None,
10721101
category_orders=None,
@@ -1075,6 +1104,9 @@ def line_geo(
10751104
color_discrete_map=None,
10761105
line_dash_sequence=None,
10771106
line_dash_map=None,
1107+
symbol_sequence=None,
1108+
symbol_map=None,
1109+
markers=False,
10781110
projection=None,
10791111
scope=None,
10801112
center=None,

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

+7-2
Original file line numberDiff line numberDiff line change
@@ -1782,8 +1782,13 @@ def infer_config(args, constructor, trace_patch, layout_patch):
17821782
trace_patch["opacity"] = args["opacity"]
17831783
else:
17841784
trace_patch["marker"] = dict(opacity=args["opacity"])
1785-
if "line_group" in args:
1786-
trace_patch["mode"] = "lines" + ("+markers+text" if args["text"] else "")
1785+
if "line_group" in args: # px.line, px.line_*, px.area
1786+
modes = set(["lines"])
1787+
if args.get("text") or args.get("symbol") or args.get("markers"):
1788+
modes.add("markers")
1789+
if args.get("text"):
1790+
modes.add("text")
1791+
trace_patch["mode"] = "+".join(modes)
17871792
elif constructor != go.Splom and (
17881793
"symbol" in args or constructor == go.Scattermapbox
17891794
):

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

+4
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)