How to use 'seaborn barplot' in Python

Every line of 'seaborn barplot' 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
this disclaimer
142def plot_bar(xs, ys, names, error_ys=None, xlabel='x', ylabel='y', title=''):
143
144 layout = go.Layout(
145 title=title,
146 xaxis=dict(
147 title=xlabel,
148 titlefont=dict(
149 family='Courier New, monospace',
150 size=18,
151 color='#7f7f7f'
152 )
153 ),
154 yaxis=dict(
155 title=ylabel,
156 titlefont=dict(
157 family='Courier New, monospace',
158 size=18,
159 color='#7f7f7f'
160 )
161 )
162 )
163
164 traces = []
165
166 for (i, y) in enumerate(ys):
167 kwargs = {}
168 if names:
169 kwargs['name'] = names[i]
170 if error_ys:
171 kwargs['error_y'] = dict(
172 type='data', # or 'percent', 'sqrt', 'constant'
173 array=error_ys[i], # values of error bars
174 visible=True
175 )
176 trace = go.Bar(
177 x = xs[i],
178 y = y,
179 **kwargs
180 )
181 traces.append(trace)
182
183 data = traces
184 print 'data', data
185
186 fig = go.Figure(data=data, layout=layout)
187 # disp = iplot(fig, filename=datetime.now().strftime('%a, %d %b %Y %H:%M:%S +0000'))
188 disp = iplot(fig) # offline mode, no need for filename.
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

158def plot_bars():
159 ylim = plt.ylim()
160 for x in np.arange(0, t[-1], presentation_time):
161 plt.plot([x, x], ylim, 'k--')

Related snippets