Created
August 3, 2017 00:26
-
-
Save stuartlynn/d0116687d94c6a2afd46b288068963ce to your computer and use it in GitHub Desktop.
bar plot end point
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@app.route('/bar.img') | |
def bar(): | |
query = request.args.get('q') | |
username = request.args.get('username') | |
api_key = request.args.get('apikey') | |
xlabel = request.args.get('xlabel') | |
ylabel = request.args.get('ylabel') | |
title = request.args.get('title') | |
data = carto_query(query,username,api_key) | |
fig = Figure() | |
ax = fig.add_subplot(111) | |
data.set_index('cat').plot(kind='barh',ax=ax) | |
ax.set_title(title) | |
ax.set_xlabel(xlabel) | |
ax.set_ylabel(ylabel) | |
return mpl2img(fig) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment