diff --git a/plotly_express/_chart_types.py b/plotly_express/_chart_types.py index fa6ce5c..a9b69d7 100644 --- a/plotly_express/_chart_types.py +++ b/plotly_express/_chart_types.py @@ -18,6 +18,7 @@ def scatter( x=None, y=None, color=None, + opacity=None, symbol=None, size=None, hover_name=None, @@ -325,6 +326,7 @@ def scatter_3d( y=None, z=None, color=None, + opacity=None, symbol=None, size=None, text=None, @@ -416,6 +418,7 @@ def scatter_ternary( b=None, c=None, color=None, + opacity=None, symbol=None, size=None, text=None, @@ -483,6 +486,7 @@ def scatter_polar( r=None, theta=None, color=None, + opacity=None, symbol=None, size=None, hover_name=None, @@ -774,6 +778,7 @@ def scatter_matrix( data_frame, dimensions=None, color=None, + opacity=None, symbol=None, size=None, category_orders={}, diff --git a/plotly_express/_core.py b/plotly_express/_core.py index a549c57..17f9e2d 100644 --- a/plotly_express/_core.py +++ b/plotly_express/_core.py @@ -141,7 +141,6 @@ def make_trace_kwargs(args, trace_spec, g, mapping_labels, sizeref, color_range) result["marker"]["sizemode"] = "area" result["marker"]["sizeref"] = sizeref mapping_labels.append(("%s=%%{%s}" % (v_label, "marker.size"), None)) - elif k == "trendline": if v in ["ols", "lowess"] and args["x"] and args["y"] and len(g) > 1: import statsmodels.api as sm @@ -620,6 +619,8 @@ def infer_config(args, constructor, trace_patch): grouped_attrs.append("marker.symbol") trace_patch = trace_patch.copy() + if "opacity" in args: + trace_patch["marker"] = dict(opacity=args["opacity"]) if "line_group" in args: trace_patch["mode"] = "lines" + ("+markers+text" if args["text"] else "") elif constructor != go.Splom and ( diff --git a/plotly_express/_doc.py b/plotly_express/_doc.py index 30aafb2..44301e1 100644 --- a/plotly_express/_doc.py +++ b/plotly_express/_doc.py @@ -91,6 +91,9 @@ "Ignored if `error_z` is `None`.", ], color=[colref, "Values from this column are used to assign color to marks."], + opacity=[ + "(number, between 0 and 1) Sets the opacity for markers." + ], line_dash=[ colref, "Values from this column are used to assign dash-patterns to lines.",