Replace all jet color map use in examples with viridis#557
Conversation
rahulporuri
left a comment
There was a problem hiding this comment.
LGTM. Apart from a couple of comments and unrelated issues about broken examples.
| @@ -123,7 +123,7 @@ class PlotUI(HasTraits): | |||
| _image_index = Instance(GridDataSource) | |||
There was a problem hiding this comment.
This example seems to be broken. When I run the example, I see the following error. This doesn't need to be fixed in this PR - but an issue (if one doesn't exist already) would be nice
python scalar_image_function_inspector_old.py
Traceback (most recent call last):
File "C:\Users\rporuri\.edm\envs\chaco-test-3.6-pyqt5\lib\site-packages\enable\qt4\base_window.py", line 213, in paintEvent
self.handler.paintEvent(event)
File "C:\Users\rporuri\.edm\envs\chaco-test-3.6-pyqt5\lib\site-packages\enable\qt4\base_window.py", line 65, in paintEvent
self._enable_window._paint(event)
File "C:\Users\rporuri\.edm\envs\chaco-test-3.6-pyqt5\lib\site-packages\enable\abstract_window.py", line 471, in _paint
self.component.draw(gc, view_bounds=(0, 0, size[0], size[1]))
File "C:\Users\rporuri\.edm\envs\chaco-test-3.6-pyqt5\lib\site-packages\enable\component.py", line 427, in draw
self._draw(gc, view_bounds, mode)
File "C:\Users\rporuri\.edm\envs\chaco-test-3.6-pyqt5\lib\site-packages\enable\component.py", line 779, in _draw
self._dispatch_draw(layer, gc, view_bounds, mode)
File "C:\Users\rporuri\.edm\envs\chaco-test-3.6-pyqt5\lib\site-packages\enable\container.py", line 273, in _dispatch_draw
component._dispatch_draw(layer, gc, new_bounds, mode)
File "C:\Users\rporuri\.edm\envs\chaco-test-3.6-pyqt5\lib\site-packages\enable\container.py", line 271, in _dispatch_draw
component._draw(gc, new_bounds, mode)
File "C:\Users\rporuri\.edm\envs\chaco-test-3.6-pyqt5\lib\site-packages\enable\component.py", line 769, in _draw
self._dispatch_draw(layer, bb, view_bounds, mode)
File "C:\Users\rporuri\.edm\envs\chaco-test-3.6-pyqt5\lib\site-packages\enable\container.py", line 273, in _dispatch_draw
component._dispatch_draw(layer, gc, new_bounds, mode)
File "C:\Users\rporuri\.edm\envs\chaco-test-3.6-pyqt5\lib\site-packages\enable\component.py", line 799, in _dispatch_draw
handler(gc, view_bounds, mode)
File "C:\Users\rporuri\.edm\envs\chaco-test-3.6-pyqt5\lib\site-packages\chaco\base_2d_plot.py", line 204, in _draw_image
self._render(gc)
File "C:\Users\rporuri\.edm\envs\chaco-test-3.6-pyqt5\lib\site-packages\chaco\contour_poly_plot.py", line 46, in _render
self._update_polys()
File "C:\Users\rporuri\.edm\envs\chaco-test-3.6-pyqt5\lib\site-packages\chaco\contour_poly_plot.py", line 86, in _update_polys
c = Cntr(xg, yg, data, ~mask)
ValueError: Arguments x, y, z, mask (if present) must have the same dimensions.
|
|
||
| # Chaco imports | ||
| from chaco.api import ArrayPlotData, jet, Plot | ||
| from chaco.api import ArrayPlotData, viridis, Plot |
There was a problem hiding this comment.
We're not even using this color map in this example - looks like we're using the accent import from chaco.default_colormaps.
The example looks very weird with the accent color map - it looks much better with viridis.
| # Chaco imports | ||
| from chaco.api import AbstractOverlay, ArrayPlotData, \ | ||
| Plot, jet, ScatterPlot, LinePlot, LinearMapper | ||
| Plot, viridis, ScatterPlot, LinePlot, LinearMapper |
There was a problem hiding this comment.
again, looks like we're not using the viridis color map in this plot but im not sure what color map is being used.
There was a problem hiding this comment.
Yeah I don't think a color map is used anywhere, they're all just line plots with the color explicitly set to blue.
fixes #552
This PR replaces all uses of the jet color map in the examples with viridis. To do this VS Code replace all was used with
jet->viridis on all files in the examples sub module.
Some examples may be better suited with a color map different from viridis, but I did not take the time to chose a color map on a per example basis. I figured at the very least viridis should be better than jet.
If it is needed for particular examples to use a different color map they can be handled specifically