Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions holoviews/plotting/bokeh/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,10 @@ def colormap_generator(palette):
options.Ellipse = Options('style', color='black')
options.Polygons = Options('style', color=Cycle(), line_color='black',
cmap=dflt_cmap)
options.Rectangles = Options('style', cmap=dflt_cmap)
options.Segments = Options('style', cmap=dflt_cmap)

# Geometries
options.Rectangles = Options('style', line_color='black')
options.Rectangles = Options('style', color=Cycle(), cmap=dflt_cmap, line_color='black')
options.Segments = Options('style', color='black', cmap=dflt_cmap)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What's the motivation for having one of these be a cycle and the other be a fixed color?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It looked like all the other "line-only" things like Segments are drawn in black, like error bars. I suppose it depends on the main use case.

For the Rectangles, I suppose it is an oversight when it was added, as the options were set twice with different values. Polygons sets a facecolor as well. OTH, things like Ellipse do not have any filling by default, so maybe Rectangles should also default to border-only in black.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The current behavior is not aligned to anything else I tried though, since it is filled by default with blue. Elements like Ellipse are not filled by default at all.


# Rasters
options.Image = Options('style', cmap=config.default_gridded_cmap)
Expand Down
5 changes: 2 additions & 3 deletions holoviews/plotting/mpl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,8 @@ def grid_selector(grid):
whiskerprops=dict(color='k', linewidth=1.5))

# Geometries
options.Rectangles = Options('style', edgecolor='black')
options.Rectangles = Options('style', color=Cycle(), cmap=dflt_cmap, edgecolor='black')
options.Segments = Options('style', color='black', cmap=dflt_cmap)

# Rasters
options.Image = Options('style', cmap=config.default_gridded_cmap, interpolation='nearest')
Expand Down Expand Up @@ -284,8 +285,6 @@ def grid_selector(grid):
options.Path = Options('style', color=Cycle(), cmap=dflt_cmap)
options.Polygons = Options('style', facecolor=Cycle(), edgecolor='black',
cmap=dflt_cmap)
options.Rectangles = Options('style', cmap=dflt_cmap)
options.Segments = Options('style', cmap=dflt_cmap)
options.Box = Options('style', color='black')
options.Bounds = Options('style', color='black')
options.Ellipse = Options('style', color='black')
Expand Down
2 changes: 1 addition & 1 deletion holoviews/plotting/plotly/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
options.Labels = Options('style', color=Cycle())

# Shapes
options.Rectangles = Options('style', line_color=dflt_shape_line_color)
options.Rectangles = Options('style', fillcolor=Cycle(), line_color=dflt_shape_line_color)
options.Bounds = Options('style', line_color=dflt_shape_line_color)
options.Path = Options('style', line_color=dflt_shape_line_color)
options.Segments = Options('style', line_color=dflt_shape_line_color)
Expand Down
2 changes: 2 additions & 0 deletions holoviews/tests/plotting/plotly/test_shapeplots.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,11 @@ def test_boxes_simple(self):
self.assertEqual(len(shapes), 2)
self.assertEqual(shapes[0], {'type': 'rect', 'x0': 0, 'y0': 0, 'x1': 1,
'y1': 1, 'xref': 'x', 'yref': 'y', 'name': '',
'fillcolor': '#30a2da',
'line': {'color': default_shape_color}})
self.assertEqual(shapes[1], {'type': 'rect', 'x0': 2, 'y0': 2, 'x1': 4,
'y1': 3, 'xref': 'x', 'yref': 'y', 'name': '',
'fillcolor': '#30a2da',
'line': {'color': default_shape_color}})
self.assertEqual(state['layout']['xaxis']['range'], [0, 4])
self.assertEqual(state['layout']['yaxis']['range'], [0, 3])
Expand Down