Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
llustrating Sorting bars in a Seaborn Bar Plot in Ascending Order Using Pandas
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vladkras
Copy link

vladkras commented Feb 15, 2019

is it possible to sort by estimated value:
sns.barplot(x='Id', y="Speed", data=df, estimator=np.mean, order=?)
?

@fedebenelli
Copy link

fedebenelli commented Jan 15, 2020

I'm looking for the same thing as you, vladkras, did you find anything useful?

@fomightez
Copy link
Author

fomightez commented Jan 15, 2020

Sorry, I had missed vladkras's comment and not replied earlier. I am looking at this now, but do you have a better example data you are looking at? Even if it is just toy data. I don't see how just changing the aggregate() function to aggregate(np.mean) wouldn't handle that here?

@fomightez
Copy link
Author

fomightez commented Jan 15, 2020

An alternative place to run this notebook is provided by sessions launched from here. Go there and click the launch binder badge to launch a session.

You can pull the notebook into the active session by running curl -O https://gist.githubusercontent.com/fomightez/bb5a9c727d93d1508187677b4d74d7c1/raw/bfa3f34ba635b33c421fa02334c8e711084de4df/SortingBarPlotExample.ipynb in a terminal or running !curl -O https://gist.githubusercontent.com/fomightez/bb5a9c727d93d1508187677b4d74d7c1/raw/bfa3f34ba635b33c421fa02334c8e711084de4df/SortingBarPlotExample.ipynb in a notebook cell. Then in the classic notebook interface you can switch to the dashboard by clicking on the Jupyter logo in the upper right and then you'll see the notebook name SortingBarPlotExample.ipynb displayed among the files listed. In the JupyterLab interface, you'll see it show up in the file list pane.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment