`plotly.express.scatter_geo`: misleading argument type for the `size` argument
See original GitHub issueThe 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
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
plotly.express.scatter_geo — 5.11.0 documentation
Parameters. data_frame (DataFrame or array-like or dict) – This argument needs to be passed for column names (and not keyword names) to be...
Read more >Plotly-Express: How to fix the color mapping when setting ...
I found a solution. The function px.scatter has an argument color_discrete_map which is exactly what I needed. color_discrete_map takes a ...
Read more >plotly.graph_objects.Scattergeo — 5.11.0 documentation
size. sizesrc. Sets the source reference on Chart Studio Cloud for size . Returns. Return type. plotly.graph_objects.scattergeo.hoverlabel.Font.
Read more >[BUG] error with size kw in px functions and non-str argument
import numpy as np import plotly.express as px df ... I thought ( df.pop is not a valid argument) but the error message...
Read more >Visualization with Plotly.Express: Comprehensive guide
Plotly.Express offers shorthand syntax to create many chart types. ... The length of argument `wide_cross` is 25, whereas the length of ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah, I should really document both the “integers are interpreted as col names” and “
px.Constant
is a valid input” in the docstrings. Thanks for the nudge 😃Yes: https://plotly.com/python/hover-text-and-formatting/#disabling-or-customizing-hover-of-columns-in-plotly-express