Skip to content

plotly.express.scatter_geo: misleading argument type for the size argument #3195

@stoufa

Description

@stoufa

The documentation of the function plotly.express.scatter_geo [1] states that the size argument can be set to an integer.
When you do that, you'll get an error similar to the following:

Traceback (most recent call last):
  File "/path/to/map.py", line 11, in <module>
    fig_map = px.scatter_geo(
  File "/path/to/miniconda3/lib/python3.8/site-packages/plotly/express/_chart_types.py", line 1031, in scatter_geo
    return make_figure(
  File "/path/to/miniconda3/lib/python3.8/site-packages/plotly/express/_core.py", line 1861, in make_figure
    args = build_dataframe(args, constructor)
  File "/path/to/miniconda3/lib/python3.8/site-packages/plotly/express/_core.py", line 1377, in build_dataframe
    df_output, wide_id_vars = process_args_into_dataframe(
  File "/path/to/miniconda3/lib/python3.8/site-packages/plotly/express/_core.py", line 1183, in process_args_into_dataframe
    raise ValueError(err_msg)
ValueError: Value of 'size' is not the name of a column in 'data_frame'. Expected one of ['col_name_1', 'col_name_2', 'col_name_3'] but received: 20

After some research, [2] [3] I found out that the correct way of doing this is via the method fig.update_traces(marker=dict(size=20))
So, we need to update the documentation to avoid obsolete and misleading argument types

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions