diff --git a/DataPlotly/core/plot_types/bar_plot.py b/DataPlotly/core/plot_types/bar_plot.py
index 2e6db616..45350337 100644
--- a/DataPlotly/core/plot_types/bar_plot.py
+++ b/DataPlotly/core/plot_types/bar_plot.py
@@ -62,6 +62,7 @@ def create_trace(settings):
'color': settings.data_defined_stroke_colors if settings.data_defined_stroke_colors else settings.properties['out_color'],
'width': settings.data_defined_stroke_widths if settings.data_defined_stroke_widths else settings.properties['marker_width']}
},
+ width=settings.data_defined_marker_sizes if settings.data_defined_marker_sizes else settings.properties['marker_size'],
opacity=settings.properties['opacity']
)]
@@ -70,5 +71,6 @@ def create_layout(settings):
layout = super(BarPlotFactory, BarPlotFactory).create_layout(settings)
layout['barmode'] = settings.layout['bar_mode']
+ layout['xaxis']['categoryorder'] = settings.layout['bar_sort']
return layout
diff --git a/DataPlotly/gui/plot_settings_widget.py b/DataPlotly/gui/plot_settings_widget.py
index 06c37c80..763bf53b 100644
--- a/DataPlotly/gui/plot_settings_widget.py
+++ b/DataPlotly/gui/plot_settings_widget.py
@@ -674,6 +674,16 @@ def refreshWidgets(self): # pylint: disable=too-many-statements,too-many-branch
self.bar_mode_combo.addItem(self.tr('Stacked'), 'stack')
self.bar_mode_combo.addItem(self.tr('Overlay'), 'overlay')
+ # BarPlot value sorting
+ self.bar_sort_combo.clear()
+ self.bar_sort_combo.addItem(self.tr('None'), 'trace')
+ self.bar_sort_combo.addItem(self.tr('Descending'), 'total descending')
+ self.bar_sort_combo.addItem(self.tr('Ascending'), 'total ascending')
+ self.bar_sort_combo.addItem(self.tr('Mean Ascending'), 'mean ascending')
+ self.bar_sort_combo.addItem(self.tr('Mean Descending'), 'mean descending')
+ self.bar_sort_combo.addItem(self.tr('Median Ascending'), 'median ascending')
+ self.bar_sort_combo.addItem(self.tr('Median Descending'), 'median descending')
+
# Histogram normalization mode
self.hist_norm_combo.clear()
self.hist_norm_combo.addItem(self.tr('Enumerated'), '')
@@ -768,6 +778,16 @@ def refreshWidgets(self): # pylint: disable=too-many-statements,too-many-branch
), None, False
)
+ # change the label and the spin box value when the bar plot is chosen
+ if self.ptype == 'bar':
+ self.marker_size_lab.setText(self.tr('Bar width'))
+ self.marker_size.setValue(0.5)
+
+ # change the label and the spin box value when the scatter plot is chosen
+ if self.ptype == 'scatter':
+ self.marker_size_lab.setText(self.tr('Marker size'))
+ self.marker_size.setValue(10)
+
# info combo for data hovering
self.info_combo.clear()
self.info_combo.addItem(self.tr('All Values'), 'all')
@@ -813,9 +833,9 @@ def refreshWidgets(self): # pylint: disable=too-many-statements,too-many-branch
self.marker_width_lab: ['scatter', 'bar', 'box', 'histogram', 'polar', 'ternary', 'violin'],
self.marker_width: ['scatter', 'bar', 'box', 'histogram', 'polar', 'ternary', 'violin'],
self.stroke_defined_button: ['scatter', 'bar', 'box', 'histogram', 'polar', 'ternary', 'violin'],
- self.marker_size_lab: ['scatter', 'polar', 'ternary'],
- self.marker_size: ['scatter', 'polar', 'ternary'],
- self.size_defined_button: ['scatter', 'polar', 'ternary'],
+ self.marker_size_lab: ['scatter', 'polar', 'ternary', 'bar'],
+ self.marker_size: ['scatter', 'polar', 'ternary', 'bar'],
+ self.size_defined_button: ['scatter', 'polar', 'ternary', 'bar'],
self.marker_type_lab: ['scatter', 'polar'],
self.marker_type_combo: ['scatter', 'polar'],
self.alpha_lab: ['scatter', 'bar', 'box', 'histogram', 'polar', 'ternary', 'violin', 'contour'],
@@ -824,6 +844,8 @@ def refreshWidgets(self): # pylint: disable=too-many-statements,too-many-branch
'violin'],
self.bar_mode_lab: ['bar', 'histogram'],
self.bar_mode_combo: ['bar', 'histogram'],
+ self.bar_sort_label: ['bar'],
+ self.bar_sort_combo: ['bar'],
self.legend_label: ['all'],
self.legend_title: ['all'],
self.legend_title_defined_button: ['all'],
@@ -1096,6 +1118,7 @@ def get_settings(self) -> PlotSettings: # pylint: disable=R0915
'range_slider': {'visible': self.range_slider_combo.isChecked(),
'borderwidth': 1},
'bar_mode': self.bar_mode_combo.currentData(),
+ 'bar_sort': self.bar_sort_combo.currentData(),
'x_type': self.x_axis_mode_combo.currentData(),
'y_type': self.y_axis_mode_combo.currentData(),
'x_inv': None if not self.invert_x_check.isChecked() else 'reversed',
@@ -1223,6 +1246,7 @@ def set_settings(self, settings: PlotSettings): # pylint: disable=too-many-stat
self.y_axis_max.setValue(settings.layout.get('y_max') if settings.layout.get('y_max', None) is not None else 0.0)
self.orientation_combo.setCurrentIndex(self.orientation_combo.findData(settings.properties.get('box_orientation', 'v')))
self.bar_mode_combo.setCurrentIndex(self.bar_mode_combo.findData(settings.layout.get('bar_mode', None)))
+ self.bar_sort_combo.setCurrentIndex(self.bar_sort_combo.findData(settings.layout.get('bar_sort', None)))
self.hist_norm_combo.setCurrentIndex(self.hist_norm_combo.findData(settings.properties.get('normalization', None)))
self.box_statistic_combo.setCurrentIndex(self.box_statistic_combo.findData(settings.properties.get('box_stat', None)))
self.outliers_combo.setCurrentIndex(self.outliers_combo.findData(settings.properties.get('box_outliers', None)))
diff --git a/DataPlotly/test/test_data_plotly_dialog.py b/DataPlotly/test/test_data_plotly_dialog.py
index 39201b0e..3b89cd8b 100644
--- a/DataPlotly/test/test_data_plotly_dialog.py
+++ b/DataPlotly/test/test_data_plotly_dialog.py
@@ -144,6 +144,7 @@ def test_settings_round_trip(self): # pylint: disable=too-many-statements
settings.layout['font_yticks_color'] = "#000000"
settings.layout['range_slider']['visible'] = True
settings.layout['bar_mode'] = 'overlay'
+ settings.layout['bar_sort'] = 'total ascending'
settings.layout['x_type'] = 'log'
settings.layout['y_type'] = 'category'
settings.layout['x_inv'] = 'reversed'
diff --git a/DataPlotly/test/test_layer.dbf b/DataPlotly/test/test_layer.dbf
index 1bb62bc6..624b3522 100644
Binary files a/DataPlotly/test/test_layer.dbf and b/DataPlotly/test/test_layer.dbf differ
diff --git a/DataPlotly/ui/dataplotly_dockwidget_base.ui b/DataPlotly/ui/dataplotly_dockwidget_base.ui
index 91ac9eba..dd526c67 100644
--- a/DataPlotly/ui/dataplotly_dockwidget_base.ui
+++ b/DataPlotly/ui/dataplotly_dockwidget_base.ui
@@ -320,7 +320,7 @@ QListWidget::item::selected {
0
- -270
+ 0
673
989
@@ -883,8 +883,8 @@ QListWidget::item::selected {
0
0
- 414
- 583
+ 673
+ 789
@@ -915,63 +915,151 @@ QListWidget::item::selected {
false
- -
-
-
- true
+
-
+
+
+ 1.000000000000000
+
+
+ 0.100000000000000
- -
-
+
-
+
+
+ -
+
+
+ Z label
+
+
+
+ -
+
+
+ Additional hover label
+
+
+
+ -
+
+
+ -
+
+
+ Grid color
+
+
+
+ -
+
- Set X Axis Bounds
+ Title and labels customization
- true
+ false
-
+
false
-
-
-
-
+
+
-
+
- Minimum
+ Y ticks font
- -
-
+
-
+
- ...
+ Y label font
- -
-
+
-
+
- ...
+ X ticks font
- -
-
+
-
+
- Maximum
+ Title font
- -
-
+
-
+
+
+ X label font
+
+
- -
-
+
-
+
+
+ -
+
+
+ QgsFontButton::ModeQFont
+
+
+
+ -
+
+
+ QgsFontButton::ModeQFont
+
+
+
+ -
+
+
+ QgsFontButton::ModeQFont
+
+
+
+ -
+
+
+ QgsFontButton::ModeQFont
+
+
+
+ -
+
+
+ -
+
+
+ QgsFontButton::ModeQFont
+
+
+
+ -
+
+
+ -
+
+
+ -
+
- -
+
-
+
+
+ ...
+
+
+
+ -
Set Y Axis Bounds
@@ -1020,48 +1108,35 @@ QListWidget::item::selected {
- -
-
-
- X label
-
-
-
- -
-
-
- -
-
-
- -
-
-
- ...
+
-
+
+
+ true
- -
-
+
-
+
- Y label
+ Plot title
- -
-
+
-
+
...
- -
-
+
-
+
- Invert Y axis
+ ...
- -
+
-
-
@@ -1082,10 +1157,31 @@ QListWidget::item::selected {
- -
-
+
-
+
+
+ -
+
+
+ X label
+
+
+
+ -
+
+
+ Invert Y axis
+
+
+
+ -
+
+
+ Bar mode
+
+
- -
+
-
-
@@ -1106,10 +1202,13 @@ QListWidget::item::selected {
- -
-
+
-
+
+
+ -
+
- ...
+ Y label
@@ -1141,181 +1240,92 @@ QListWidget::item::selected {
- -
-
-
- Bar mode
-
-
-
- -
-
-
- -
-
-
- 1.000000000000000
-
-
- 0.100000000000000
-
-
-
- -
-
-
- -
-
-
- Grid color
-
-
-
- -
-
-
- Invert X axis
-
-
-
- -
-
-
- Bar gap
-
-
-
- -
-
-
- Plot title
-
-
-
- -
-
-
- Additional hover label
-
-
-
- -
-
+
-
+
- Title and labels customization
+ Set X Axis Bounds
- false
-
-
true
-
-
-
-
-
- Y ticks font
-
-
-
- -
-
+
+ false
+
+
+
-
+
- Y label font
+ Minimum
- -
-
+
-
+
- X ticks font
+ ...
- -
-
+
-
+
- Title font
+ ...
- -
-
+
-
+
- X label font
-
-
-
- -
-
-
- -
-
-
- QgsFontButton::ModeQFont
-
-
-
- -
-
-
- QgsFontButton::ModeQFont
-
-
-
- -
-
-
- QgsFontButton::ModeQFont
-
-
-
- -
-
-
- QgsFontButton::ModeQFont
-
-
-
- -
-
-
- -
-
-
- QgsFontButton::ModeQFont
+ Maximum
- -
-
-
- -
-
+
-
+
- -
-
+
-
+
- -
-
+
-
+
- -
-
+
-
+
+
+ Bar gap
+
+
+
+ -
+
...
- -
-
+
-
+
- Z label
+ Invert X axis
+
+
+
+ -
+
+
+ Sort values
+ -
+
+
+ -
+
+