{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Horizontal bar chart\n\nThis example showcases a simple horizontal bar chart.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n\nfig, ax = plt.subplots()\n\n# Example data\npeople = ('Tom', 'Dick', 'Harry', 'Slim', 'Jim')\nperformance = [5, 7, 6, 4, 9]\nerror = [0.2, 0.4, 0.3, 0.6, 0.2]\n\nax.barh(people, performance, xerr=error, align='center')\nax.yaxis.set_inverted(True) # arrange data from top to bottom\nax.set_xlabel('Performance')\nax.set_title('How fast do you want to go today?')\n\nplt.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ ".. tags::\n\n plot-type: bar\n level: beginner\n\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.15" } }, "nbformat": 4, "nbformat_minor": 0 }