enthought / chaco

Chaco is a Python package for building interactive and custom 2-D plots.
http://docs.enthought.com/chaco/
Other
291 stars 101 forks source link

MAINT: replace deprecated boston dataset with diabetes #870

Closed homosapien-lcy closed 1 year ago

homosapien-lcy commented 1 year ago

The load_boston dataset is deprecated, replacing with the diabetes dataset (seems to the the only usable dataset in sklearn.dataset, iris and california housing dataset is not compatible with the code).

However, there are two more errors arised after the fix that I found the fixes but want to discuss:

After correcting the dataset, an error will happen in get_image_from_file() since this function tries to read an image in the demo/basic/capitol.jpg, but the folder doesn't seem to exist anymore, removing this function can fix this problem.

Then, another error will happend in chaco.chaco.plots.polar_line_renderer, in function _draw_plot(). Function will try to call _render on gc (line 136), which is a parameter not exists. Removing this line can solve the problem (this also causes exception in issue #875 )

When both the above fixes are done, the plots can be generated without error. But are these fixes sounds good to you?

dpinte commented 1 year ago

The capitol.jpg image is still available here: https://github.com/enthought/chaco/blob/cbf53e733e5cbfae6338b46faf29032cf73bf899/chaco/examples/demo/basic/capitol.jpg

dpinte commented 1 year ago

@homosapien-lcy you should update the code to use the importlib.resources to access the file.

homosapien-lcy commented 1 year ago

Will use importlib_resource to find capitol.jpg

dpinte commented 1 year ago

@homosapien-lcy by the way, I think it's important to split the issues into different PR's. Everything related to fixing the create_plot_snapshot can be done in this PR (but then the PR must be renamed). The issue with polar renderer is not a problem with the demo but a bug in chaco. That should be a different PR!

homosapien-lcy commented 1 year ago

@homosapien-lcy by the way, I think it's important to split the issues into different PR's. Everything related to fixing the create_plot_snapshot can be done in this PR (but then the PR must be renamed). The issue with polar renderer is not a problem with the demo but a bug in chaco. That should be a different PR!

Got it, separating into two other issues #879 #881