How to use 'pie chart in python seaborn' in Python

Every line of 'pie chart in python seaborn' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
281def generate_bar_chart(chart_data, bottoms=None, bar_width=0.4, labels=[], orientation='vertical'):
282 """
283 Creates a bar chart for revenue using chart_data.
284 """
285 fig, ax = plt.subplots(figsize=(12, 6))
286
287 # Get the revenue data from the ValOp objects.
288 indices = np.arange(len(chart_data))
289
290 # Plot.
291 with sb.axes_style('whitegrid'):
292 if bottoms is None:
293 if orientation == 'horizontal':
294 ax.barh(indices, chart_data, height=bar_width, color=PALETTE)
295 plt.yticks(indices, labels, rotation=0)
296 ax.set_xticklabels(['{:,}'.format(int(x)) for x in ax.get_xticks().tolist()]) # Comma separator for y-axis tick labels.
297 else:
298 ax.bar(indices, chart_data, width=bar_width, color=PALETTE)
299 plt.xticks(indices, labels, rotation=0)
300 ax.set_yticklabels(['{:,}'.format(int(x)) for x in ax.get_yticks().tolist()]) # Comma separator for y-axis tick labels.
301 else:
302 if orientation == 'horizontal':
303 ax.barh(indices, chart_data, left=bottoms, height=bar_width, color=PALETTE)
304 plt.yticks(indices, labels, rotation=0)
305 ax.set_xticklabels(['{:,}'.format(int(x)) for x in ax.get_xticks().tolist()]) # Comma separator for y-axis tick labels.
306 # ax.set_xlim(0, max(chart_data))
307 else:
308 ax.bar(indices, chart_data, bottom=bottoms, width=bar_width, color=PALETTE)
309 plt.xticks(indices, labels, rotation=0)
310 ax.set_yticklabels(['{:,}'.format(int(x)) for x in ax.get_yticks().tolist()]) # Comma separator for y-axis tick labels.
311 # ax.set_ylim(0, max(chart_data))
312
313 # sb.despine(offset=10, trim=True)
314
315 return fig, ax
255def pie(self, values_column, labels_column, title=''):
256 subplot = self._get_new_subplot()
257 subplot.pie(self.data[values_column], labels=self.data[labels_column],
258 autopct='%2.2f%%')
259 subplot.set_title(title)

Related snippets