-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
make error messages more helpful when choropleth features and data don't match #4529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks @afeld - I love those class notes, beautiful! It would certainly be useful to have a warning in this case, but it's a little tricky to figure out how to make that happen. The Python-side validators are all codegen from the JavaScript schema, and anyway they aren't intended to capture interactions between different attributes. The obvious place to put this is in JavaScript where we put this all together, and some error situations already do generate messages there, though it's not clear to me if the cases you're describing would: https://github.com/plotly/plotly.js/blob/master/src/lib/geo_location_utils.js - that said even if we do get the right messages there you'll only see them in the JS console, not in Python or in the main browser window, and most Python users won't know to look there. |
Thanks, and thanks for the quick response! After a bunch of experimentation, reading source code, and some help from ChatGPT, I've learned that the file you pointed me to does have that functionality already, but it's disabled by default. It can be enabled with: Plotly.setPlotConfig({ logging: 2 }); …but that isn't documented 🙃 Created an example in Codepen. Unfortunately, it's not clear to me how to do that from Python/Colab. Configuration options can be passed to Thoughts? |
|
Issue around allowing logging to be configured via |
I teach a class for students that are new to coding. We use plotly, and I'm happy to have a package that gets students good-looking graphs in so little code.
I introduce plotly's choropleth maps, and have repeatedly run into the issue where the students get confused by what the
featureidkey
is referring to and how that relates to thelocations
. I do my best to explain this, but they are (understandably) confused working across CSVs and GeoJSON. One student just hit an issue where they were trying to use FIPS codes, but theirlocations
column had leading whitespace. When the rows are unable to be matched to a feature, it fails silently.My feature request is to provide a warning when the
featureidkey
andlocations
have zero matches.I haven't contributed to the plotly codebase before, but I'd be open to doing so if the maintainers are open to receiving this. Presumably the place to add this check is one of the validators?
Thanks!
The text was updated successfully, but these errors were encountered: