[Flask] Creating a bar chart with std and displaying

Andrea D'Amore and.damore at gmail.com
Sat Jul 23 08:23:19 EDT 2016


On 22 July 2016 at 21:39, Mazzei, Stephen Andrew
<Stephen.Mazzei at asrcfederal.com> wrote:
> means = grouped.mean()
> errors = grouped.std()
> fig, ax = plt.subplots()
> means.plot.bar(yerr=errors, ax=ax, legend=None))

> Which does work, though kind of hard to see. Is there a better way to do this?

What do you mean by hard to see, is the figure too small?
And what kind of "better" are you looking for?

If you are looking for more compact code the following line should be
equivalent to what you wrote since DataFrame.plot() is able to create
its own figure and axis:

    grouped.mean().plot(kind='bar', yerr=grouped.std(), legend=False)


> If this is a fine way of doing this, my next question is how do I present this to flask front end? Do I need to save this to a .png and then load the .png on the server?

Isn't the code already running on the server? What do you mean by
"load on the server"?


-- 
Andrea


More information about the Flask mailing list