Skip to content

Commit e2f8678

Browse files
author
minjk-bl
committed
Add heatmap option to Seaborn app
1 parent 047dd1b commit e2f8678

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

visualpython/data/m_visualize/seabornLibrary.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ define([
5656
{ name: 'y', component: ['col_select'], usePair: true },
5757
{ name: 'hue', component: ['col_select'], usePair: true },
5858
{ name: 'bins', component: ['input_number'], usePair: true },
59-
{ name: 'kde', component: ['option_select'], usePair: true },
60-
{ name: 'stat', component: ['bool_select'], usePair: true },
59+
{ name: 'kde', component: ['bool_select'], usePair: true },
60+
{ name: 'stat', component: ['option_select'], usePair: true },
6161
{ name: 'allocateTo', label: 'Allocate To', component: ['input'], usePair: true }
6262
]
6363
},
@@ -169,6 +169,19 @@ define([
169169
{ name: 'hue', component: ['col_select'], usePair: true },
170170
{ name: 'allocateTo', label: 'Allocate To', component: ['input'], usePair: true }
171171
]
172+
},
173+
'heatmap': {
174+
name: 'Heatmap',
175+
code: '${allocateTo} = sns.heatmap(${data}${x}${y}${hue}${annot}${etc})',
176+
description: 'Plot rectangular data as a color-encoded matrix.',
177+
options: [
178+
{ name: 'data', component: ['var_select'], var_type: ['DataFrame', 'Series', 'list'], usePair: true },
179+
{ name: 'x', component: ['col_select'], usePair: true },
180+
{ name: 'y', component: ['col_select'], usePair: true },
181+
{ name: 'hue', component: ['col_select'], usePair: true },
182+
{ name: 'annot', component: ['bool_select'], usePair: true },
183+
{ name: 'allocateTo', label: 'Allocate To', component: ['input'], usePair: true }
184+
]
172185
}
173186
}
174187

visualpython/html/m_visualize/seaborn.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,14 @@
114114
<!-- Auto-create -->
115115
</select>
116116
</div>
117+
<div class="vp-grid-box sb-option">
118+
<label for="annot" class="vp-bold">Annot</label>
119+
<select id="annot" class="vp-state">
120+
<option value="">Select option...</option>
121+
<option value="True">True</option>
122+
<option value="False">False</option>
123+
</select>
124+
</div>
117125
<div class="vp-grid-box sb-option" style="grid-column-start: 1;grid-column-end: 3;">
118126
<hr style="margin:5px;"/>
119127
<label class="vp-tab-group-title">Sort</label>

visualpython/js/m_visualize/Seaborn.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ define([
9292
this.chartTypeList = {
9393
'Relational': [ 'scatterplot', 'lineplot' ],
9494
'Distributions': [ 'histplot', 'kdeplot', 'rugplot' ],
95-
'Categorical': [ 'stripplot', 'swarmplot', 'boxplot', 'violinplot', 'pointplot', 'barplot' ],
96-
'ETC': [ 'countplot' ]
95+
'Categorical': [ 'stripplot', 'swarmplot', 'boxplot', 'violinplot', 'pointplot', 'barplot', 'countplot' ],
96+
'Axes-level': [ 'heatmap' ],
9797
}
9898

9999
this.legendPosList = [
@@ -217,6 +217,8 @@ define([
217217
$(that.wrapSelector('#sortHue')).closest('.sb-option').show();
218218
}
219219
}
220+
} else if (chartType == 'heatmap') {
221+
$(that.wrapSelector('#annot')).closest('.sb-option').show();
220222
}
221223
});
222224

@@ -545,6 +547,8 @@ define([
545547
$(page).find('#sortHue').closest('.sb-option').show();
546548
}
547549
}
550+
} else if (this.state.chartType == 'heatmap') {
551+
$(page).find('#annot').closest('.sb-option').show();
548552
}
549553

550554
//================================================================

0 commit comments

Comments
 (0)