Skip to content

Commit 1b8cc36

Browse files
author
minjk-bl
committed
Add orient option to barplot on Seaborn
1 parent 20ba6f3 commit 1b8cc36

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

visualpython/data/m_visualize/seabornLibrary.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,14 @@ define([
148148
},
149149
'barplot': {
150150
name: 'Bar Plot',
151-
code: '${allocateTo} = sns.barplot(${data}${x}${y}${hue}${etc})',
151+
code: '${allocateTo} = sns.barplot(${data}${x}${y}${hue}${orient}${etc})',
152152
description: 'Show point estimates and confidence intervals as rectangular bars.',
153153
options: [
154154
{ name: 'data', component: ['var_select'], var_type: ['DataFrame', 'Series', 'list'], usePair: true },
155155
{ name: 'x', component: ['col_select'], usePair: true },
156156
{ name: 'y', component: ['col_select'], usePair: true },
157157
{ name: 'hue', component: ['col_select'], usePair: true },
158+
{ name: 'orient', component: ['option_select'], usePair: true },
158159
{ name: 'allocateTo', label: 'Allocate To', component: ['input'], usePair: true }
159160
]
160161
},

visualpython/html/m_visualize/seaborn.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,14 @@
100100
<label for="bins" class="vp-bold">Bins</label>
101101
<input type="number" class="vp-input vp-state" id="bins" placeholder="Type bins" step="5" min="0" />
102102
</div>
103+
<div class="vp-grid-box sb-option">
104+
<label for="orient" class="vp-bold">Orient</label>
105+
<select id="orient" class="vp-select vp-state">
106+
<option value="">Select option...</option>
107+
<option value="'v'">Vertical</option>
108+
<option value="'h'">Horizontal</option>
109+
</select>
110+
</div>
103111
<div class="vp-grid-box sb-option">
104112
<label for="kde" class="vp-bold">Kde</label>
105113
<select id="kde" class="vp-select vp-state">

visualpython/js/m_visualize/Seaborn.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ define([
3232

3333
this.config.dataview = false;
3434
this.config.size = { width: 1064, height: 550 };
35+
this.config.autoScroll = false;
3536
this.config.checkModules = ['plt', 'sns'];
3637
this.config.docs = 'https://seaborn.pydata.org/index.html';
3738

@@ -201,6 +202,7 @@ define([
201202
$(that.wrapSelector('#kde')).closest('.sb-option').show();
202203
$(that.wrapSelector('#stat')).closest('.sb-option').show();
203204
} else if (chartType == 'barplot') {
205+
$(that.wrapSelector('#orient')).closest('.sb-option').show();
204206
$(that.wrapSelector('#showValues')).closest('.sb-option').show();
205207
$(that.wrapSelector('#errorbar')).closest('.sb-option').show();
206208
if (that.state.setXY === false) {
@@ -547,6 +549,7 @@ define([
547549
$(page).find('#kde').closest('.sb-option').show();
548550
$(page).find('#stat').closest('.sb-option').show();
549551
} else if (this.state.chartType == 'barplot') {
552+
$(page).find('#orient').closest('.sb-option').show();
550553
$(page).find('#showValues').closest('.sb-option').show();
551554
$(page).find('#errorbar').closest('.sb-option').show();
552555
if (this.state.setXY === false) {
@@ -890,7 +893,7 @@ define([
890893

891894
generateCode(preview=false) {
892895
let {
893-
chartType, data, x, y, setXY, hue, kde, stat,
896+
chartType, data, x, y, setXY, hue, orient, kde, stat,
894897
showValues, showValuesPrecision, errorbar,
895898
sortType, sortBy, sortHue, sortHueText,
896899
userOption='',

0 commit comments

Comments
 (0)