Matplotlib is Python’s main 2D plotting library for publication-quality figures, covering pyplot for line charts, histograms, and scatter plots.
Introduction to Matplotlib
What is Matplotlib?
Matplotlib is a Python 2D plotting library that can generate publication-quality figures in many hard-copy formats and interactive environments. It can be used in Python scripts, the Python and IPython shell, Jupyter notebooks, web application servers, and multiple GUI toolkits.Matplotlib tries to make easy things easy and hard things possible. With just a few lines of code, you can create charts, histograms, power spectra, bar charts, error plots, scatter plots, and more. See the basic plotting examples and the gallery for inspiration.For simple plotting, the pyplot module offers an interface similar to MATLAB, especially when used with IPython. Advanced users can also rely on the object-oriented API for full control over line styles, fonts, axes, and other details.
Learning from the official examples
If you want to learn how to draw a specific kind of chart, the best places to start are the gallery and the pyplot command reference. Do not be afraid of the official docs. Even when they are in English or lightly annotated, they are still the most complete reference. The translated pages are usually good enough for reading, and when a function is still hard to understand, you can always search the community or ask someone more experienced.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"bangwu's Knowledge Base","description":"A beginner-friendly tutorial knowledge base covering frontend, backend, tools, environment, and course notes.","colors":{"primary":"#14b8a6","light":"#99f6e4","dark":"#0f766e"},"logo":"https://mintcdn.com/bangwu/VbDlNmxI4fJmE9K4/assets/joker.png?fit=max\u0026auto=format\u0026n=VbDlNmxI4fJmE9K4\u0026q=85\u0026s=49e4439ce9f483c11cf6fe88f7a4ece8","favicon":{"light":"https://mintcdn.com/bangwu/VbDlNmxI4fJmE9K4/assets/joker.png?fit=max\u0026auto=format\u0026n=VbDlNmxI4fJmE9K4\u0026q=85\u0026s=49e4439ce9f483c11cf6fe88f7a4ece8","dark":"https://mintcdn.com/bangwu/VbDlNmxI4fJmE9K4/assets/joker.png?fit=max\u0026auto=format\u0026n=VbDlNmxI4fJmE9K4\u0026q=85\u0026s=49e4439ce9f483c11cf6fe88f7a4ece8"},"appearance":{"default":"system"},"footer":{"socials":{"github":"https://github.com/markbang","x-twitter":"https://x.com/bangwu_","website":"https://bangwu.me"}},"seo":{"metatags":{"og:site_name":"bangwu's Knowledge Base","twitter:card":"summary_large_image"},"indexing":"all"},"fonts":{"family":"Ubuntu","format":"woff2"},"icons":{"library":"fontawesome"},"styling":{"eyebrows":"breadcrumbs","codeblocks":{"theme":{"light":"github-light","dark":"github-dark"}},"latex":true},"contextual":{"options":["copy"],"display":"header"},"thumbnails":{"background":"https://mintcdn.com/bangwu/VbDlNmxI4fJmE9K4/assets/joker.png?fit=max\u0026auto=format\u0026n=VbDlNmxI4fJmE9K4\u0026q=85\u0026s=49e4439ce9f483c11cf6fe88f7a4ece8"},"metadata":{"timestamp":true},"navigation":{"languages":[{"language":"en","default":true,"banner":{"content":"You're viewing the English version. [Switch to Chinese →](/zh)","dismissible":true},"footer":{"socials":{"github":"https://github.com/markbang","x-twitter":"https://x.com/bangwu_","website":"https://bangwu.me"}},"navbar":{"links":[{"href":"https://bangwu.me","label":"Blog"},{"href":"https://github.com/markbang","label":"GitHub"}]},"href":""},{"language":"zh","banner":{"content":"你正在查看中文版本。[切换到英文 →](/)","dismissible":true},"footer":{"socials":{"github":"https://github.com/markbang","x-twitter":"https://x.com/bangwu_","website":"https://bangwu.me"}},"navbar":{"links":[{"href":"https://bangwu.me","label":"博客"},{"href":"https://github.com/markbang","label":"GitHub"}]},"href":"zh"}]}},"deployment":{"deploymentMetadataValue":{"subdomain":"bangwu","hasAudioNarration":false,"actualSubdomain":"bangwu","customDomains":["base.bangwu.me"],"gitSource":{"type":"github","owner":"markbang","repo":"documentation","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"feedback":{"thumbs":true,"edits":true,"issues":true},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6b07c999c85466c2264f487d","clientVersion":"0.0.4377","searchFilterCounts":[{"language":"en","tag":"Tools \u0026 Environment","count":44},{"language":"zh","tag":"工具与环境","count":44},{"language":"en","tag":"Tech","count":40},{"language":"zh","tag":"技术","count":40},{"language":"en","tag":"Backend","count":25},{"language":"zh","tag":"后端","count":25},{"language":"en","tag":"Environment \u0026 Deployment","count":24},{"language":"zh","tag":"环境与部署","count":24},{"language":"en","tag":"Courses \u0026 About","count":21},{"language":"zh","tag":"课程与关于","count":21},{"language":"en","tag":"Course Notes","count":19},{"language":"zh","tag":"课程复习","count":19},{"language":"en","tag":"Software","count":18},{"language":"zh","tag":"软件","count":18},{"language":"en","tag":"Python","count":12},{"language":"zh","tag":"Python","count":12},{"language":"en","tag":"Libraries","count":8},{"language":"en","tag":"Frontend","count":8},{"language":"zh","tag":"常用库","count":8},{"language":"zh","tag":"前端","count":8}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":true},"customCss":[{"filePath":"stylesheets/extra.css","content":"audio{display:block;width:min(100%, 36rem);margin:1rem 0;border-radius:0.75rem}"}]}
{"page":{"pagePath":"backend/Python/libs/matplotlib","slug":"/backend/Python/libs/matplotlib","pageMetadata":{"title":"Matplotlib","description":"Matplotlib is Python's main 2D plotting library for publication-quality figures, covering pyplot for line charts, histograms, and scatter plots.","icon":"chart-bar","href":"/backend/Python/libs/matplotlib"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Matplotlib is Python’s main 2D plotting library for publication-quality figures, covering pyplot for line charts, histograms, and scatter plots.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,img:`img`,p:`p`,..._provideComponents(),...props.components},{Heading}=_components;if(!Heading)_missingMdxReference(`Heading`,true);return _jsxs(_Fragment,{children:[_jsx(Heading,{level:`1`,id:`introduction-to-matplotlib`,children:`Introduction to Matplotlib`}),`\n`,_jsx(Heading,{level:`2`,id:`what-is-matplotlib`,children:`What is Matplotlib?`}),`\n`,_jsxs(_components.p,{children:[`Matplotlib is a Python 2D plotting library that can generate publication-quality figures in many hard-copy formats and interactive environments. It can be used in Python scripts, the Python and `,_jsx(_components.a,{href:`http://ipython.org/`,children:`IPython`}),` shell, `,_jsx(_components.a,{href:`http://jupyter.org/`,children:`Jupyter`}),` notebooks, web application servers, and multiple GUI toolkits.`]}),`\n`,_jsxs(_components.p,{children:[`Matplotlib tries to make easy things easy and hard things possible. With just a few lines of code, you can create charts, histograms, power spectra, bar charts, error plots, scatter plots, and more. See the `,_jsx(_components.a,{href:`https://www.matplotlib.org.cn/tutorials/introductory/sample_plots.html`,children:`basic plotting examples`}),` and the `,_jsx(_components.a,{href:`https://www.matplotlib.org.cn/gallery/index.html`,children:`gallery`}),` for inspiration.`]}),`\n`,_jsx(_components.p,{children:_jsx(_components.img,{src:`https://bangwu.oss-cn-shanghai.aliyuncs.com/img/202305130748189.png`,alt:`img`})}),`\n`,_jsxs(_components.p,{children:[`For simple plotting, the `,_jsx(_components.code,{children:`pyplot`}),` module offers an interface similar to MATLAB, especially when used with IPython. Advanced users can also rely on the object-oriented API for full control over line styles, fonts, axes, and other details.`]}),`\n`,_jsx(Heading,{level:`2`,id:`learning-from-the-official-examples`,children:`Learning from the official examples`}),`\n`,_jsxs(_components.p,{children:[`If you want to learn how to draw a specific kind of chart, the best places to start are the `,_jsx(_components.a,{href:`https://www.matplotlib.org.cn/gallery`,children:`gallery`}),` and the `,_jsx(_components.a,{href:`https://matplotlib.org/api/pyplot_summary.html`,children:`pyplot command reference`}),`. Do not be afraid of the official docs. Even when they are in English or lightly annotated, they are still the most complete reference. The translated pages are usually good enough for reading, and when a function is still hard to understand, you can always search the community or ask someone more experienced.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"codeStyling":{"theme":{"light":"github-light","dark":"github-dark"}},"config":{},"pageMetadata":{"title":"Matplotlib","description":"Matplotlib is Python's main 2D plotting library for publication-quality figures, covering pyplot for line charts, histograms, and scatter plots.","icon":"chart-bar","href":"/backend/Python/libs/matplotlib"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Introduction to Matplotlib","slug":"introduction-to-matplotlib","depth":1,"children":[]},{"title":"What is Matplotlib?","slug":"what-is-matplotlib","depth":2,"children":[]},{"title":"Learning from the official examples","slug":"learning-from-the-official-examples","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/bangwu/e2364d9b2004c901/javascripts/analytics.js","/_mintlify/custom/bangwu/173755828f84db45/javascripts/mathjax.js"],"subdomain":"bangwu","siteName":"bangwu's Knowledge Base","title":"Matplotlib - bangwu's Knowledge Base","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{"en":{"href":"/backend/Python/libs/matplotlib","matchLevel":0},"zh":{"href":"/zh/backend/Python/libs/matplotlib","matchLevel":1}}},"lastModified":"2026-04-17T16:53:14.581Z","gitLastModified":"2026-04-17T16:52:50.000Z","originalFileLocation":"backend/Python/libs/matplotlib.md","locale":"en"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Matplotlib is Python\u0026#x27;s main 2D plotting library for publication-quality figures, covering pyplot for line charts, histograms, and scatter plots.\">\u003cmeta data-mint-head name=\"application-name\" content=\"bangwu\u0026#x27;s Knowledge Base\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/bangwu/OdCmcQtqG9X3Dfmg/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/bangwu/OdCmcQtqG9X3Dfmg/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/bangwu/OdCmcQtqG9X3Dfmg/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/bangwu/OdCmcQtqG9X3Dfmg/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/bangwu/OdCmcQtqG9X3Dfmg/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/bangwu/OdCmcQtqG9X3Dfmg/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/bangwu/OdCmcQtqG9X3Dfmg/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/bangwu/OdCmcQtqG9X3Dfmg/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/bangwu/OdCmcQtqG9X3Dfmg/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Matplotlib - bangwu\u0026#x27;s Knowledge Base\">\u003cmeta data-mint-head property=\"og:description\" content=\"Matplotlib is Python\u0026#x27;s main 2D plotting library for publication-quality figures, covering pyplot for line charts, histograms, and scatter plots.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"bangwu\u0026#x27;s Knowledge Base\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://base.bangwu.me/backend/Python/libs/matplotlib\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://bangwu.mintlify.site/_mintlify/api/og/v2?division=Libraries\u0026amp;title=Matplotlib\u0026amp;description=Matplotlib+is+Python%27s+main+2D+plotting+library+for+publication-quality+figures%2C+covering+pyplot+for+line+charts%2C+histograms%2C+and+scatter+plots.\u0026amp;theme=1c6ee84771a83b18370ffd69\u0026amp;signature=202fbdd9229c53a710a9e39270b4c631b014bc24e96b4b04f53d89a30645c5b9\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Matplotlib - bangwu\u0026#x27;s Knowledge Base\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Matplotlib is Python\u0026#x27;s main 2D plotting library for publication-quality figures, covering pyplot for line charts, histograms, and scatter plots.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://bangwu.mintlify.site/_mintlify/api/og/v2?division=Libraries\u0026amp;title=Matplotlib\u0026amp;description=Matplotlib+is+Python%27s+main+2D+plotting+library+for+publication-quality+figures%2C+covering+pyplot+for+line+charts%2C+histograms%2C+and+scatter+plots.\u0026amp;theme=1c6ee84771a83b18370ffd69\u0026amp;signature=202fbdd9229c53a710a9e39270b4c631b014bc24e96b4b04f53d89a30645c5b9\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/bangwu/OdCmcQtqG9X3Dfmg/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"bangwu\u0026#x27;s Knowledge Base\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#14b8a6\">\u003clink data-mint-head rel=\"canonical\" href=\"https://base.bangwu.me/backend/Python/libs/matplotlib\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/backend/Python/libs/matplotlib.md\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"en\" href=\"https://base.bangwu.me/backend/Python/libs/matplotlib\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"zh\" href=\"https://base.bangwu.me/zh/backend/Python/libs/matplotlib\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"x-default\" href=\"https://base.bangwu.me/backend/Python/libs/matplotlib\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://base.bangwu.me/#organization\",\"name\":\"bangwu's Knowledge Base\",\"url\":\"https://base.bangwu.me\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/bangwu/VbDlNmxI4fJmE9K4/assets/joker.png?fit=max\u0026auto=format\u0026n=VbDlNmxI4fJmE9K4\u0026q=85\u0026s=49e4439ce9f483c11cf6fe88f7a4ece8\"}},{\"@type\":\"WebSite\",\"@id\":\"https://base.bangwu.me#website\",\"name\":\"bangwu's Knowledge Base\",\"url\":\"https://base.bangwu.me\",\"publisher\":{\"@id\":\"https://base.bangwu.me/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://base.bangwu.me/backend/Python/libs/matplotlib#webpage\",\"url\":\"https://base.bangwu.me/backend/Python/libs/matplotlib\",\"name\":\"Matplotlib\",\"description\":\"Matplotlib is Python's main 2D plotting library for publication-quality figures, covering pyplot for line charts, histograms, and scatter plots.\",\"dateModified\":\"2026-04-17T16:52:50.000Z\",\"isPartOf\":{\"@id\":\"https://base.bangwu.me#website\"},\"breadcrumb\":{\"@id\":\"https://base.bangwu.me/backend/Python/libs/matplotlib#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://base.bangwu.me/backend/Python/libs/matplotlib#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Backend\",\"item\":\"https://base.bangwu.me/backend\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python\",\"item\":\"https://base.bangwu.me/backend/Python\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Libraries\",\"item\":\"https://base.bangwu.me/backend/Python/libs\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Matplotlib\",\"item\":\"https://base.bangwu.me/backend/Python/libs/matplotlib\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://base.bangwu.me/backend/Python/libs/matplotlib#article\",\"headline\":\"Matplotlib\",\"name\":\"Matplotlib\",\"description\":\"Matplotlib is Python's main 2D plotting library for publication-quality figures, covering pyplot for line charts, histograms, and scatter plots.\",\"url\":\"https://base.bangwu.me/backend/Python/libs/matplotlib\",\"mainEntityOfPage\":{\"@id\":\"https://base.bangwu.me/backend/Python/libs/matplotlib#webpage\"},\"dateModified\":\"2026-04-17T16:52:50.000Z\",\"publisher\":{\"@id\":\"https://base.bangwu.me/#organization\"},\"isPartOf\":{\"@id\":\"https://base.bangwu.me#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"bangwu's Knowledge Base\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"bangwu's Knowledge Base\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/backend/Python/libs/matplotlib.md","siteName":"bangwu's Knowledge Base","nav":{"global":null,"languages":[{"language":"en","default":true,"banner":{"content":"You're viewing the English version. [Switch to Chinese →](/zh)","dismissible":true},"footer":{"socials":{"github":"https://github.com/markbang","x-twitter":"https://x.com/bangwu_","website":"https://bangwu.me"}},"navbar":{"links":[{"href":"https://bangwu.me","label":"Blog"},{"href":"https://github.com/markbang","label":"GitHub"}]},"tabs":[{"tab":"Start","icon":"house","pages":[{"title":"Start","href":""}]},{"tab":"Tech","icon":"code","groups":[{"group":"Backend","icon":"server","pages":[{"title":"Backend","icon":"server","href":"/backend"},{"title":"Consensus under network jitter","icon":"network-wired","href":"/backend/consensus"},{"group":"Python","icon":"python","pages":[{"title":"Python","icon":"python","href":"/backend/Python/index"},{"title":"FastAPI","icon":"bolt","href":"/backend/Python/fastapi"},{"group":"Web Scraping","icon":"spider","pages":[{"title":"Web Scraping","icon":"spider","href":"/backend/Python/spider/index"},{"title":"Anti-Scraping Techniques","icon":"shield","href":"/backend/Python/spider/anti-spider"}]},{"group":"Libraries","icon":"cubes","pages":[{"title":"Python Libraries","icon":"cubes","href":"/backend/Python/libs/index"},{"title":"HTTPX","icon":"globe","href":"/backend/Python/libs/httpx"},{"title":"WordCloud","description":"WordCloud is a Python library for word cloud visualizations, covering custom shape masks, color schemes, Chinese segmentation with jieba.","icon":"cloud","href":"/backend/Python/libs/wordcloud"},{"title":"Matplotlib","icon":"chart-bar","href":"/backend/Python/libs/matplotlib"},{"title":"PyTorch","description":"PyTorch deep learning framework guide covering CPU and GPU installation, tensor creation and operations, automatic differentiation, and neural network basics.","icon":"fire","href":"/backend/Python/libs/PyTorch"},{"title":"Python learning notes","icon":"note-sticky","href":"/backend/Python/libs/python-notes"},{"title":"PyAutoGUI","icon":"robot","href":"/backend/Python/libs/pyautogui"},{"title":"Python data types","icon":"list","href":"/backend/Python/libs/data-types"}]}]},{"group":"Go","icon":"golang","pages":[{"title":"Go","icon":"golang","href":"/backend/Go/index"},{"title":"Go Gin","icon":"bolt","href":"/backend/Go/gin/index"},{"title":"Go listeners and MPTCP","icon":"network-wired","href":"/backend/Go/mptcp"}]},{"group":"Rust","icon":"rust","pages":[{"title":"Rust","icon":"rust","href":"/backend/Rust/index"},{"title":"Rust IM Bridge (AgentIM)","icon":"rust","href":"/backend/Rust/agentim"}]},{"group":"Auth \u0026 ORM","icon":"shield-halved","pages":[{"title":"RBAC \u0026 Session Auth","icon":"shield-halved","href":"/backend/auth/rbac"},{"title":"Drizzle ORM","icon":"database","href":"/backend/orm/drizzle"}]},{"group":"Databases","icon":"database","pages":[{"title":"Databases","icon":"database","href":"/backend/SQL/index"},{"title":"MySQL","icon":"database","href":"/backend/SQL/mysql"},{"title":"Database principles","icon":"graduation-cap","href":"/backend/SQL/db-knowledge"},{"title":"SQLite","icon":"file-code","href":"/backend/SQL/sqlite"}]}]},{"group":"Frontend","icon":"browser","pages":[{"title":"Frontend","icon":"browser","href":"/frontend/index"},{"group":"Vue","icon":"vuejs","pages":[{"title":"Vue.js","icon":"vuejs","href":"/frontend/Vue/index"},{"title":"Naive UI","icon":"cube","href":"/frontend/Vue/NaiveUI"}]},{"group":"React Full-Stack","icon":"code","pages":[{"title":"TanStack Start + Hono","icon":"code","href":"/frontend/tanstack"},{"title":"Next.js","icon":"nextjs","href":"/frontend/Nextjs/index"}]},{"group":"SolidJS Desktop","icon":"laptop-code","pages":[{"title":"SolidJS + Tauri Desktop","icon":"laptop-code","href":"/frontend/solidjs"}]},{"group":"CSS Tools","icon":"palette","pages":[{"title":"Tailwind CSS","icon":"palette","href":"/frontend/TailwindCSS/index"},{"title":"DaisyUI","icon":"palette","href":"/frontend/daisyui"}]}]},{"group":"Desktop","icon":"laptop","pages":[{"title":"Desktop Development","icon":"laptop","href":"/software/index"},{"title":"Tauri","icon":"laptop-code","href":"/software/tauri"},{"title":"Monorepo Architecture","icon":"cubes","href":"/software/monorepo"},{"title":"Engineering team organization","icon":"users","href":"/software/engineering-org"}]},{"group":"Algorithms","icon":"brain","pages":[{"title":"Algorithm Learning","icon":"brain","href":"/algo/index"},{"title":"Sliding window","icon":"window-maximize","href":"/algo/sliding_window"},{"title":"Bit manipulation","icon":"microchip","href":"/algo/bit"}]}]},{"tab":"Tools \u0026 Environment","icon":"wrench","pages":[{"title":"Tools \u0026 Environment","href":"/apps"}]},{"tab":"Courses \u0026 About","icon":"graduation-cap","pages":[{"title":"Courses \u0026 About","href":"/about"}]}]},{"language":"zh","banner":{"content":"你正在查看中文版本。[切换到英文 →](/)","dismissible":true},"footer":{"socials":{"github":"https://github.com/markbang","x-twitter":"https://x.com/bangwu_","website":"https://bangwu.me"}},"navbar":{"links":[{"href":"https://bangwu.me","label":"博客"},{"href":"https://github.com/markbang","label":"GitHub"}]},"pages":[{"title":"zh","href":"/zh/backend/Python/libs/matplotlib"}]}]},"basePath":"","title":"Matplotlib - bangwu's Knowledge Base","deploymentId":"dpl_Ab6nteg7kvyK8iL73naC2n7fmsWK","buildId":"dpl_Ab6nteg7kvyK8iL73naC2n7fmsWK","dynamics":["10e4515597","a74be98ba7"],"chunks":["BannerMarkdown-C4eRUFHa.js","dist-DzZqOeCq.js","lib-DMeTj1gb.js","lib-B8HbPgcC.js","katex-Dbtb6Wk7.js","html-void-elements-mCSPHezU.js","marked.esm-CZWythHk.js","zoom-image-lightbox-DHIkV4p4.js","lightbox-handle-r17bVUz3.js"]}