Skip to content
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

Replace all jet color map use in examples with viridis #557

Merged
merged 2 commits into from
Jan 8, 2021

Conversation

aaronayres35
Copy link
Contributor

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

Copy link
Contributor

@rahulporuri rahulporuri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Apart from a couple of comments and unrelated issues about broken examples.

@@ -123,7 +123,7 @@ class PlotUI(HasTraits):
_image_index = Instance(GridDataSource)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened #558

@@ -18,7 +18,7 @@
from traitsui.api import Item, Group, View

# Chaco imports
from chaco.api import ArrayPlotData, jet, Plot
from chaco.api import ArrayPlotData, viridis, Plot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@@ -25,7 +25,7 @@

# Chaco imports
from chaco.api import AbstractOverlay, ArrayPlotData, \
Plot, jet, ScatterPlot, LinePlot, LinearMapper
Plot, viridis, ScatterPlot, LinePlot, LinearMapper
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, looks like we're not using the viridis color map in this plot but im not sure what color map is being used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I don't think a color map is used anywhere, they're all just line plots with the color explicitly set to blue.

@aaronayres35 aaronayres35 merged commit 596538d into master Jan 8, 2021
@rahulporuri rahulporuri deleted the dont-use-jet branch March 23, 2021 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't use jet colormap in examples
2 participants