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

Corr plot module #220

Merged
merged 30 commits into from
Nov 23, 2020
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
f61a696
fillDiagonal in correlation utils
IKrukov-HORIS Oct 28, 2020
8d5253b
corr.py module
IKrukov-HORIS Oct 28, 2020
879af8a
Removed format parameter
IKrukov-HORIS Oct 28, 2020
fd3d999
Removed _get_format method
IKrukov-HORIS Oct 28, 2020
6927fcd
_tooltip_spec without format parameter
IKrukov-HORIS Oct 28, 2020
4c079ab
flip = True by default
IKrukov-HORIS Oct 28, 2020
d1240b5
flip = True by default
IKrukov-HORIS Oct 28, 2020
53912e8
flip = True by default
IKrukov-HORIS Nov 10, 2020
04bbd2b
_set_diverging_palette renamed to _set_brewer_palette
IKrukov-HORIS Nov 10, 2020
791deef
Using API in build
IKrukov-HORIS Nov 10, 2020
9e6e822
Removed div arg
IKrukov-HORIS Nov 10, 2020
2d0eee9
layers creation deferred till build
IKrukov-HORIS Nov 10, 2020
6dbfcbd
Legend change: Correlation -> Corr
IKrukov-HORIS Nov 11, 2020
4e74f4c
Add fill_scale
IKrukov-HORIS Nov 11, 2020
0f51ad7
tiles implemented via geom_tile
IKrukov-HORIS Nov 11, 2020
f3495e0
Fixed tile implementation.
IKrukov-HORIS Nov 12, 2020
8e4c8e5
Fix height calculation
IKrukov-HORIS Nov 12, 2020
3aabfeb
coord_cartesian when tiles layer is active
IKrukov-HORIS Nov 16, 2020
84d893f
tiles width / height = 0.99
IKrukov-HORIS Nov 17, 2020
663666c
Additive expand 0.5
IKrukov-HORIS Nov 17, 2020
0116ad0
Set fill_diagonal in StatProto
IKrukov-HORIS Nov 17, 2020
7b240e9
Change parameter passing way and some defaults
IKrukov-HORIS Nov 18, 2020
35dda1e
correlation matrix examples
IKrukov-HORIS Nov 18, 2020
709fe1b
Fix typo in methods names
IKrukov-HORIS Nov 18, 2020
ce6aac2
Fix typo in demo
IKrukov-HORIS Nov 18, 2020
25c24b5
Demo layout fix
IKrukov-HORIS Nov 18, 2020
f821be6
brewer palette legend fix
IKrukov-HORIS Nov 19, 2020
80deb81
brewer palette legend fix in demo
IKrukov-HORIS Nov 19, 2020
6eb36e8
brewer palette example update
IKrukov-HORIS Nov 20, 2020
206be8f
add scale_fill_identity for tiles na values
IKrukov-HORIS Nov 23, 2020
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
Prev Previous commit
Next Next commit
Change parameter passing way and some defaults
  • Loading branch information
IKrukov-HORIS committed Nov 18, 2020
commit 7b240e942f1c6dbf4dccb5a2b933c55cdb726e5a
41 changes: 13 additions & 28 deletions python-package/lets_plot/bistro/corr.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __init__(self, data, show_legend=True, flip=True):
mid=corr_plot_builder._DEF_MID_COLOR,
high=corr_plot_builder._DEF_HIGH_COLOR)

def points(self, type=None, fill_diagonal=None):
def points(self, type=None, fill_diagonal=True):
"""
Method defines correlation matrix layer drawn by points to the plot.

Expand All @@ -82,17 +82,11 @@ def points(self, type=None, fill_diagonal=None):
-------
self
"""
self._points_params = {}

if type:
self._points_params['type'] = self._get_type(type)

if fill_diagonal:
self._points_params['fill_diagonal'] = fill_diagonal
self._points_params = {'type': self._get_type(type), 'fill_diagonal': fill_diagonal}

return self

def labels(self, type=None, fill_diagonal=None, map_size=False, color=None):
def labels(self, type=None, fill_diagonal=True, map_size=False, color=None):
"""
Method defines correlation matrix layer drawn with geom_text to the plot.

Expand All @@ -111,23 +105,17 @@ def labels(self, type=None, fill_diagonal=None, map_size=False, color=None):
self
"""

self._labels_params = {}

if type:
self._labels_params['type'] = self._get_type(type)

if fill_diagonal:
self._labels_params['fill_diagonal'] = fill_diagonal
self._labels_params = {'type': self._get_type(type), 'fill_diagonal': fill_diagonal}

if not map_size:
self._labels_params['size'] = 1

if color:
if color is not None:
self._labels_params['color'] = color

return self

def tiles(self, type=None, fill_diagonal=None):
def tiles(self, type=None, fill_diagonal=True):
"""
Method defines correlation matrix layer drawn as square tiles to the plot.

Expand All @@ -143,13 +131,7 @@ def tiles(self, type=None, fill_diagonal=None):
self
"""

self._tiles_params = {}

if type:
self._tiles_params['type'] = self._get_type(type)

if fill_diagonal:
self._tiles_params['fill_diagonal'] = fill_diagonal
self._tiles_params = {'type': self._get_type(type), 'fill_diagonal': fill_diagonal}

return self

Expand Down Expand Up @@ -179,10 +161,13 @@ def build(self):
**self._points_params)

if self._labels_params is not None:
if self._tiles_params is not None and 'color' not in self._labels_params:
self._labels_params['color'] = 'white'
m = None

if 'size' not in self._labels_params:
m = aes(size='..corr_abs..')

plot += geom_text(stat='corr', show_legend=self._show_legend,
mapping=m,
tooltips=self._tooltip_spec(),
na_value='', label_format=self._format,
size_unit='x', **self._labels_params)
Expand Down Expand Up @@ -462,7 +447,7 @@ def corr_plot_tileslab(data, palette=None):
"""
plot_builder = corr_plot_builder(data=data)
plot_builder.tiles()
plot_builder.labels()
plot_builder.labels(color='white')

if palette:
plot_builder._set_brewer_palette(palette)
Expand Down