-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Description
import numpy as np
import plotly.express as px
df = px.data.gapminder()
fig = px.scatter(df, x=df.gdpPercap, y=df.lifeExp, color=df.continent, size=df.pop,
facet_col=df.year, facet_col_wrap=4)
fig.show()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-4-b52564550e30> in <module>
3 df = px.data.gapminder()
4 fig = px.scatter(df, x=df.gdpPercap, y=df.lifeExp, color=df.continent, size=df.pop,
----> 5 facet_col=df.year, facet_col_wrap=4)
6 fig.show()
~/code/plotly.py/packages/python/plotly/plotly/express/_chart_types.py in scatter(data_frame, x, y, color, symbol, size, hover_name, hover_data, custom_data, text, facet_row, facet_col, facet_col_wrap, error_x, error_x_minus, error_y, error_y_minus, animation_frame, animation_group, category_orders, labels, color_discrete_sequence, color_discrete_map, color_continuous_scale, range_color, color_continuous_midpoint, symbol_sequence, symbol_map, opacity, size_max, marginal_x, marginal_y, trendline, trendline_color_override, log_x, log_y, range_x, range_y, render_mode, title, template, width, height)
53 in 2D space.
54 """
---> 55 return make_figure(args=locals(), constructor=go.Scatter)
56
57
~/code/plotly.py/packages/python/plotly/plotly/express/_core.py in make_figure(args, constructor, trace_patch, layout_patch)
1099
1100 args, trace_specs, grouped_mappings, sizeref, show_colorbar = infer_config(
-> 1101 args, constructor, trace_patch
1102 )
1103 grouper = [x.grouper or one_group for x in grouped_mappings] or [one_group]
~/code/plotly.py/packages/python/plotly/plotly/express/_core.py in infer_config(args, constructor, trace_patch)
975 all_attrables += [group_attr]
976
--> 977 args = build_dataframe(args, all_attrables, array_attrables)
978
979 attrs = [k for k in attrables if k in args]
~/code/plotly.py/packages/python/plotly/plotly/express/_core.py in build_dataframe(args, attrables, array_attrables)
939 else: # numpy array, list...
940 col_name = _check_name_not_reserved(field, reserved_names)
--> 941 if length and len(argument) != length:
942 raise ValueError(
943 "All arguments should have the same length. "
TypeError: object of type 'method' has no len()
(the problem is with the size
argument)
Metadata
Metadata
Assignees
Labels
No labels