Skip to content

Commit 90cb174

Browse files
authored
Merge branch 'dev' into fix/mpl-plot-colors
2 parents 4cf9beb + 47da5a5 commit 90cb174

13 files changed

Lines changed: 58 additions & 41 deletions

CHANGELOG.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [0.23.1]
8+
## [0.24.0]
9+
### Add
10+
- Allow to directly specify if axes are on or off in Python
911

1012
### Fix
11-
1213
- LineSegment2D : If it is overloaded, MPL Plot now show the right edge_style instead of generating of random one
1314

14-
## [0.23.0]
1515

16+
## [0.23.0]
1617
### Feat
1718
- Add events (Subject) to emit shape hovering and clicking
1819
- Highlight shapes when corresponding function is called from wrapper software

code_pylint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
'trailing-whitespace': 11,
3636
'empty-docstring': 7,
3737
'missing-module-docstring': 4,
38-
'too-many-arguments': 23,
38+
'too-many-arguments': 24,
3939
'too-few-public-methods': 5,
4040
'unnecessary-comprehension': 5,
4141
'no-value-for-parameter': 2,

cypress/e2e/figures.cy.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ describe("Figure", function() {
3535
{ "name": "", "cx": 3, "cy": 3, "type_": "point" },
3636
{ "name": "", "cx": 8, "cy": 3, "type_": "point" },
3737
{ "name": "", "data": [66, 11.5, 73, 11.5], "point1": [66, 11.5], "point2": [73, 11.5], "type_": "linesegment2d" }
38-
]
38+
],
39+
"axis_on": true
3940
};
4041

4142
it('should create a new instance of Figure from multiplot data with valid arguments', function() {
@@ -209,7 +210,8 @@ describe("Histogram", function() {
209210
{ "name": "", "values": { "x": 3, "y": 2 }, "x": 3, "y": 2 },
210211
{ "name": "", "values": { "x": 4, "y": 3 }, "x": 4, "y": 3 }
211212
],
212-
"type_": "histogram"
213+
"type_": "histogram",
214+
"axis_on": true
213215
};
214216
const histogram = new Histogram(data, canvas.width, canvas.height, 0, 0, canvasID, false);
215217
histogram.setCanvas(canvas.id);
@@ -270,7 +272,8 @@ describe("Scatter", function() {
270272
{ "name": "", "values": { "x": 3, "y": 2 }, "x": 3, "y": 2 },
271273
{ "name": "", "values": { "x": 4, "y": 3 }, "x": 4, "y": 3 }
272274
],
273-
"type_": "scatterplot"
275+
"type_": "scatterplot",
276+
"axis_on": true
274277
}
275278
const scatter = new Scatter(data, canvas.width, canvas.height, 0, 0, canvasID, false);
276279
const frameMatrix = new DOMMatrix([
@@ -334,7 +337,8 @@ describe("Graph2D", function() {
334337
]
335338
},
336339
],
337-
"type_": "graph2d"
340+
"type_": "graph2d",
341+
"axis_on": true
338342
}
339343
const graph = new Graph2D(data, canvas.width, canvas.height, 0, 0, canvasID, false);
340344

@@ -366,7 +370,8 @@ describe("ParallelPlot", function() {
366370
{ "name": "", "values": { "x": 3, "y": 2, "z": 2 }, "x": 3, "y": 2, "z": 2 },
367371
{ "name": "", "values": { "x": 4, "y": 3, "z": 5 }, "x": 4, "y": 3, "z": 5 }
368372
],
369-
"type_": "parallelplot"
373+
"type_": "parallelplot",
374+
"axis_on": true
370375
}
371376
const parallelplot = new ParallelPlot(data, canvas.width, canvas.height, 0, 0, canvasID, false);
372377
parallelplot.setCanvas(canvas.id);
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading

plot_data/core.py

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,10 @@ class Figure(PlotDataObject):
110110

111111
_standalone_in_db = True
112112

113-
def __init__(self, type_: str, width: int = 750, height: int = 400, name: str = '', **kwargs):
113+
def __init__(self, type_: str, width: int = 750, height: int = 400, axis_on: bool = True, name: str = '', **kwargs):
114114
self.width = width
115115
self.height = height
116+
self.axis_on = axis_on
116117
PlotDataObject.__init__(self, type_=type_, name=name, **kwargs)
117118

118119
@property
@@ -876,7 +877,7 @@ class Graph2D(Figure):
876877

877878
def __init__(self, graphs: List[Dataset], x_variable: str, y_variable: str, axis: Axis = None,
878879
log_scale_x: bool = None, log_scale_y: bool = None, width: int = 750, height: int = 400,
879-
name: str = ''):
880+
axis_on: bool = True, name: str = ''):
880881
self.graphs = graphs
881882
self.attribute_names = [x_variable, y_variable]
882883
if axis is None:
@@ -885,7 +886,7 @@ def __init__(self, graphs: List[Dataset], x_variable: str, y_variable: str, axis
885886
self.axis = axis
886887
self.log_scale_x = log_scale_x
887888
self.log_scale_y = log_scale_y
888-
super().__init__(width=width, height=height, type_='graph2d', name=name)
889+
super().__init__(width=width, height=height, type_='graph2d', axis_on=axis_on, name=name)
889890

890891
def mpl_plot(self, ax=None, **kwargs):
891892
""" Plots using matplotlib. """
@@ -1052,7 +1053,7 @@ class Scatter(Figure):
10521053
def __init__(self, x_variable: str = None, y_variable: str = None, tooltip: Tooltip = None,
10531054
point_style: PointStyle = None, elements: List[Sample] = None, points_sets: List[PointFamily] = None,
10541055
axis: Axis = None, log_scale_x: bool = None, log_scale_y: bool = None, heatmap: Heatmap = None,
1055-
heatmap_view: bool = None, width: int = 750, height: int = 400, name: str = ''):
1056+
heatmap_view: bool = None, width: int = 750, height: int = 400, axis_on: bool = True, name: str = ''):
10561057
self.tooltip = tooltip
10571058
self.attribute_names = [x_variable, y_variable]
10581059
self.point_style = point_style
@@ -1079,7 +1080,7 @@ def __init__(self, x_variable: str = None, y_variable: str = None, tooltip: Tool
10791080
self.heatmap = heatmap
10801081
self.heatmap_view = heatmap_view
10811082
self.points_sets = points_sets
1082-
super().__init__(width=width, height=height, type_='scatterplot', name=name)
1083+
super().__init__(width=width, height=height, type_='scatterplot', axis_on=axis_on, name=name)
10831084

10841085

10851086
class ScatterMatrix(Figure):
@@ -1089,7 +1090,8 @@ class ScatterMatrix(Figure):
10891090
_plot_buttons = "MULTIPLOT_BUTTONS"
10901091

10911092
def __init__(self, elements: List[Sample] = None, axes: List[str] = None, point_style: PointStyle = None,
1092-
surface_style: SurfaceStyle = None, width: int = 750, height: int = 400, name: str = ""):
1093+
surface_style: SurfaceStyle = None, width: int = 750, height: int = 400, axis_on: bool = True,
1094+
name: str = ""):
10931095
if elements is None:
10941096
elements = []
10951097
sampled_elements = []
@@ -1109,7 +1111,7 @@ def __init__(self, elements: List[Sample] = None, axes: List[str] = None, point_
11091111
self.surface_style = surface_style
11101112
self.plots = self._build_multiplot()
11111113
self.initial_view_on = True
1112-
super().__init__(width=width, height=height, type_="multiplot", name=name)
1114+
super().__init__(width=width, height=height, type_="multiplot", axis_on=axis_on, name=name)
11131115

11141116
def _build_multiplot(self):
11151117
sample_attributes = self.elements[0].values.keys()
@@ -1296,10 +1298,10 @@ class PrimitiveGroup(Figure):
12961298

12971299
def __init__(self, primitives: List[Union[Contour2D, Arc2D, LineSegment2D, Circle2D,
12981300
Line2D, MultipleLabels, Wire, Point2D]], width: int = 750,
1299-
height: int = 400, attribute_names: List[str] = None, name: str = ''):
1301+
height: int = 400, attribute_names: List[str] = None, axis_on: bool = False, name: str = ''):
13001302
self.primitives = primitives
13011303
self.attribute_names = attribute_names
1302-
super().__init__(width=width, height=height, type_='draw', name=name)
1304+
super().__init__(width=width, height=height, type_='draw', axis_on=axis_on, name=name)
13031305

13041306
def mpl_plot(self, ax=None, equal_aspect=True, **kwargs):
13051307
""" Plots using matplotlib. """
@@ -1357,7 +1359,8 @@ class PrimitiveGroupsContainer(Figure):
13571359

13581360
def __init__(self, primitive_groups: List[PrimitiveGroup], sizes: List[Tuple[float, float]] = None,
13591361
coords: List[Tuple[float, float]] = None, associated_elements: List[int] = None,
1360-
x_variable: str = None, y_variable: str = None, width: int = 750, height: int = 400, name: str = ''):
1362+
x_variable: str = None, y_variable: str = None, width: int = 750, height: int = 400,
1363+
axis_on: bool = True, name: str = ''):
13611364
for i, value in enumerate(primitive_groups):
13621365
if not isinstance(value, PrimitiveGroup):
13631366
primitive_groups[i] = PrimitiveGroup(primitives=value)
@@ -1375,7 +1378,7 @@ def __init__(self, primitive_groups: List[PrimitiveGroup], sizes: List[Tuple[flo
13751378
if y_variable:
13761379
attribute_names.append(y_variable)
13771380
self.association['attribute_names'] = attribute_names
1378-
super().__init__(width=width, height=height, type_='primitivegroupcontainer', name=name)
1381+
super().__init__(width=width, height=height, type_='primitivegroupcontainer', axis_on=axis_on, name=name)
13791382

13801383

13811384
class ParallelPlot(Figure):
@@ -1396,7 +1399,7 @@ class ParallelPlot(Figure):
13961399

13971400
def __init__(self, elements: List[Sample] = None, edge_style: EdgeStyle = None, disposition: str = None,
13981401
axes: List[str] = None, rgbs: List[Tuple[int, int, int]] = None, width: int = 750, height: int = 400,
1399-
name: str = ''):
1402+
axis_on: bool = True, name: str = ''):
14001403
if elements is None:
14011404
elements = []
14021405
sampled_elements = []
@@ -1415,7 +1418,7 @@ def __init__(self, elements: List[Sample] = None, edge_style: EdgeStyle = None,
14151418
self.disposition = disposition
14161419
self.attribute_names = axes
14171420
self.rgbs = rgbs
1418-
super().__init__(width=width, height=height, type_='parallelplot', name=name)
1421+
super().__init__(width=width, height=height, type_='parallelplot', axis_on=axis_on, name=name)
14191422

14201423

14211424
class Histogram(Figure):
@@ -1443,7 +1446,7 @@ class Histogram(Figure):
14431446

14441447
def __init__(self, x_variable: str, elements=None, axis: Axis = None, graduation_nb: float = None,
14451448
edge_style: EdgeStyle = None, surface_style: SurfaceStyle = None, width: int = 750, height: int = 400,
1446-
name: str = ''):
1449+
axis_on: bool = True, name: str = ''):
14471450
if elements is None:
14481451
elements = []
14491452
sampled_elements = []
@@ -1463,7 +1466,7 @@ def __init__(self, x_variable: str, elements=None, axis: Axis = None, graduation
14631466
self.graduation_nb = graduation_nb
14641467
self.edge_style = edge_style
14651468
self.surface_style = surface_style
1466-
super().__init__(width=width, height=height, type_='histogram', name=name)
1469+
super().__init__(width=width, height=height, type_='histogram', axis_on=axis_on, name=name)
14671470

14681471

14691472
class MultiplePlots(Figure):
@@ -1483,7 +1486,8 @@ class MultiplePlots(Figure):
14831486

14841487
def __init__(self, plots: List[PlotDataObject], sizes: List[Window] = None, elements: List[Sample] = None,
14851488
coords: List[Tuple[float, float]] = None, point_families: List[PointFamily] = None,
1486-
initial_view_on: bool = None, width: int = 750, height: int = 400, name: str = ''):
1489+
initial_view_on: bool = None, width: int = 750, height: int = 400, axis_on: bool = True,
1490+
name: str = ''):
14871491
if elements is None:
14881492
elements = []
14891493
sampled_elements = []
@@ -1503,7 +1507,7 @@ def __init__(self, plots: List[PlotDataObject], sizes: List[Window] = None, elem
15031507
self.coords = coords
15041508
self.points_sets = point_families
15051509
self.initial_view_on = initial_view_on
1506-
super().__init__(width=width, height=height, type_='multiplot', name=name)
1510+
super().__init__(width=width, height=height, type_='multiplot', axis_on=axis_on, name=name)
15071511

15081512

15091513
def plot_data_path(local: bool = False, version: str = None):

0 commit comments

Comments
 (0)