{
  "source_file": "0930",
  "source_platform": "Medium",
  "author": "Dario Radečić",
  "title_listed": "How to Create a Custom Matplotlib Theme and Make Your Charts Go from Boring to Amazing",
  "keywords": "Matplotlib,可视化",
  "domain": "数据处理",
  "content_type": "深度技术解析",
  "is_paid_flag": "部分免费/会员墙",
  "url": "https://towardsdatascience.com/how-to-create-a-custom-matplotlib-theme-and-make-your-charts-go-from-boring-to-amazing-bb2998945c8f/",
  "publish_date": "2024-09",
  "corpus_stage": "预训练/SFT",
  "notes": "",
  "id": "5e51b93518d0",
  "collected_at": "2026-10-01T20:54:40",
  "title": "How to Create a Custom Matplotlib Theme and Make Your Charts Go from Boring to Amazing | Towards Data Science",
  "body_markdown": "Toggle Search[](https://towardsdatascience.com/)Toggle Mobile Navigation\n[](https://towardsdatascience.com/)\nPublish AI, ML & data-science insights to a global community of data professionals.\nSign in[Submit an Article](https://write.insightmediagroup.io)\n[Latest](https://towardsdatascience.com/latest/)[Editor's Picks](https://towardsdatascience.com/tag/editors-pick/)[Newsletter](https://towardsdatascience.com/tag/the-variable/)[ShipAI](https://towardsdatascience.com/shipai/)\n* * *\n[Write For TDS](https://towardsdatascience.com/submissions/)\n[LinkedIn](https://www.linkedin.com/company/towards-data-science/)[X](https://x.com/TDataScience)Toggle Search\n[Data Science](https://towardsdatascience.com/category/data-science/)\n# How to Create a Custom Matplotlib Theme and Make Your Charts Go from Boring to Amazing\nThe best part? You'll only have to do this once.\n[Dario Radečić](https://towardsdatascience.com/author/radecicdario/)\nSeptember 5, 20246 min read\n![Article thumbnail \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/09/11uzg9ZZfplOJIDbQ09B4Zg.png)\nArticle thumbnail (image by author)\nEvery Matplotlib chart has the potential to go viral. But not with the default theme.\nLet's be honest: default styles aren't going to stop anyone in their tracks. If you want to make your reader pay attention, you'll need more than a [resolution bump or a new font](https://darioradecic.substack.com/p/you-need-to-fix-these-3-things-right). You'll need a custom theme.\nIt's the only way to make your charts look _yours_. It's the only way to make your reader stop scrolling. **The good news?** Matplotlib makes it incredibly easy to write custom style sheets from scratch. Even better - you can make your custom theme available system-wide!\nAnd in today's article, you'll learn how to do just that.\n## Two Functions You'll Need For Plotting Bar and Line Charts\nFor the sake of repeatability, I'll provide you with two functions for plotting a bar and a line chart.\nThe goal of setting a custom Matplotlib theme isn't to change the underlying Python code - but rather to leave it as is - and see what the visual differences are.\nHere are the libraries you'll need to follow along:\npython\n\n```\nimport numpy as npimport matplotlib as mplimport matplotlib.pyplot as plt\n```\n\nLet's go over both functions.\nLearn this step by step with the interactive [AI and Data Scientist](https://roadmap.sh/ai-data-scientist), [Computer Science](https://roadmap.sh/computer-science) and [Data Analyst](https://roadmap.sh/data-analyst) roadmaps.\n### Bar Charts\nThe `plot_bar()` function creates a stacked bar chart representing the employee count per location and department.\nThe data is completely made up, and the only \"hard coded\" bit is the `y` position of the title. It's increased ever so slightly to create more room between the title and the plot.\nYou can tweak the `legend_pos` value when calling this function. I've deliberately made this part tweakable so you can adjust the offset for the legend. It'll always be different, so it's nice to have some flexibility.\nEverything else is pretty minimal and self-explanatory:\npython\n\n```\ndef plot_bar(legend_pos: tuple = (1.25, 1)):    x = np.array([\"New York\", \"San Francisco\", \"Los Angeles\", \"Chicago\", \"Miami\"])    y1 = np.array([50, 63, 40, 68, 35])    y2 = np.array([77, 85, 62, 89, 58])    y3 = np.array([50, 35, 79, 43, 67])    y4 = np.array([59, 62, 33, 77, 72])    plt.bar(x, y1, label=\"HR\")    plt.bar(x, y2, bottom=y1, label=\"Engineering\")    plt.bar(x, y3, bottom=y1 + y2, label=\"Marketing\")    plt.bar(x, y4, bottom=y1 + y2 + y3, label=\"Sales\")    plt.title(\"Employee Count Per Location And Department\", y=1.06)    plt.xlabel(\"Office Location\")    plt.ylabel(\"Count\")    plt.legend(bbox_to_anchor=legend_pos)    plt.show()\n```\n\n### Line Charts\nThe `plot_line()` function is pretty similar, but it displays made-up yearly revenues.\nIn other words, it shows a line plot of revenue generated by each office location from 2018 to 2023:\npython\n\n```\ndef plot_line(legend_pos: tuple = (1.25, 1)):    x = [2018, 2019, 2020, 2021, 2023]    ny = [100, 124, 154, 133, 167]    sf = [89, 95, 109, 139, 155]    la = [107, 144, 179, 161, 175]    ch = [59, 91, 99, 117, 141]    mi = [121, 99, 104, 131, 140]    plt.plot(x, ny, label=\"New York\")    plt.plot(x, sf, label=\"San Francisco\")    plt.plot(x, la, label=\"Los Angeles\")    plt.plot(x, ch, label=\"Chicago\")    plt.plot(x, mi, label=\"Miami\")    plt.title(\"Yearly Revenue\", y=1.06)    plt.xlabel(\"Year\")    plt.ylabel(\"Revenue (M)\")    plt.legend(bbox_to_anchor=legend_pos)       plt.show()\n```\n\nSo, how do these charts look by default?\n### A Terrible-Looking Example\nAs the title suggests - terrible. And I do mean terrible.\nTake a look for yourself, and feel free to tweak the legend offset if you get some overlap:\npython\n\n```\nplot_bar(legend_pos=(1.32, 1))plot_line(legend_pos=(1.05, 1))\n```\n\n![Image 1 - Ugly bar chart \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/09/13UFsOFYX54RrpUUsc2XTGQ.png)\nImage 1 - Ugly bar chart (image by author)\n![Image 2 - Ugly line chart \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/09/1_stux95J3q2zjmeBvCIrmw.png)\nImage 2 - Ugly line chart (image by author)\nThe font is meh, the colors are boring, and the resolution is unreasonably low.\n**You don't want to share this with your coworkers, let alone your boss.** A custom theme can fix all of the above and then some.\n## Matplotlib Stylesheets - How to Create a Custom Matpltolib Theme\nStart by creating a file with an `.mplstyle` extension. I've named mine `custom.mplstyle`.\nIn this file, you can tweak everything ([literally everything](https://matplotlib.org/stable/users/explain/customizing.html)) Matplotlib related. I'll keep things simple and change a handful of things that will make a world of difference:\n  * **Generic tweaks** - Default figure size and resolution, color palette ([Tableau colorblind](https://jrnold.github.io/ggthemes/reference/tableau_color_pal-21.png)), and plot spines.\n  * **Text** - [Custom font](https://fonts.google.com/specimen/IBM+Plex+Sans?query=ibm+plex+sans) (must be installed on your system), font size, title location and style, and size of axis labels/ticks.\n  * **Legend** - Location and the number of data points representing a single item.\n  * **Grid** - Always show the grid as a light gray [dotted line](https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.grid.html) behind the chart contents.\n  * **Chart type specific tweaks** - Default width of a line in a line chart, and including markers.\n\n\nPaste the following into your `.mplstyle` file:\nplaintext\n\n```\n# Generic figure tweaksfigure.figsize: 10, 6  figure.dpi: 125  savefig.dpi: 300 savefig.bbox: tight  axes.prop_cycle: cycler(\"color\", [\"006ba4\", \"ff800e\", \"ababab\", \"595959\", \"5f9ed1\", \"c85200\", \"898989\", \"a2c8ec\", \"ffbc79\", \"cfcfcf\"])axes.spines.top: Falseaxes.spines.right: False# Textfont.size: 14font.family: sans-seriffont.sans-serif: IBM Plex Sansaxes.titlesize: 20axes.titleweight: boldaxes.titlelocation: leftaxes.labelsize: largextick.labelsize: mediumytick.labelsize: medium# Legendlegend.loc: \"upper right\"legend.numpoints: 3 legend.scatterpoints: 3# Gridaxes.grid: Trueaxes.axisbelow: True  grid.color: \"#d3d3d3\"grid.linestyle: : grid.linewidth: 1.0# Line chart onlylines.linewidth: 3lines.marker: olines.markersize: 8\n```\n\nSo, how can you reference this file in Python?\n### A Superb-Looking Example\nYou only need to add one line of code to use your custom theme:\nYou only need to add one line of code to use your custom theme:\npython\n\n```\nplt.style.use(\"custom.mplstyle\")\n```\n\nA typical place to do so is right after importing Matplotlib. That's not a requirement, just a best practice.\nThis is what your charts will look like now:\npython\n\n```\nplot_bar()plot_line()\n```\n\n![Image 3 - Pretty bar chart \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/09/1phsWMO7RNcZULVSqjhf9kA.png)\nImage 3 - Pretty bar chart (image by author)\n![Image 4 - Pretty line chart \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/09/13uNpgcvWuyP6H-eEZr-XHQ.png)\nImage 4 - Pretty line chart (image by author)\nIdentical code, but a night and day visual difference, to say at least.\n## How to Make Your Custom Matplotlib Theme Available Globally\nBringing the `mplstyle` file to every new project isn't a huge inconvenience, but you can do better.\nWhat \"better\" means is making the custom stylesheet available globally, or at least inside a virtual environment.\nStart by finding out where Matplotlib is installed:\npython\n\n```\nmpl.__file__\n```\n\n![Image 5 - Environment-specific Matplotlib location](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/09/1XPxw2A5J-xjOcIaSDbve2A.png)\nImage 5 - Environment-specific Matplotlib location\nYou need the entire path without the `__init__.py` part.\nAssuming you're in a notebook environment, run the following command (after replacing the path) to copy the `mplstyle` file to Matplotlib's style library directory:\npython\n\n```\n!cp custom.mplstyle /Users/dradecic/miniforge3/envs/py/lib/python3.11/site-packages/matplotlib/mpl-data/stylelib/custom-style.mplstyle\n```\n\nNote that I've renamed the file.\nIf you're not in a notebook environment, just omit the exclamation at the start and run the command from the console.\nAnyhow, after restarting the kernel, you should see your stylesheet listed:\npython\n\n```\nimport matplotlib.pyplot as pltplt.style.available\n```\n\n![Image 6 - Available Matplotlib styles \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/09/18O1QPEjxMwJmK_3hY9VjIg.png)\nImage 6 - Available Matplotlib styles (image by author)\nYou can now reference it from any script or notebook running in the virtual environment:\npython\n\n```\nplt.style.use(\"custom-style\")\n```\n\nTo demonstrate, I've created a new chart in a separate notebook. The data it shows is completely arbitrary.\nThe important thing is that the custom theme works:\npython\n\n```\nimport matplotlib.pyplot as pltplt.style.use(\"custom-style\")x = [2019, 2020, 2021, 2022, 2023, 2024]plt.plot(x, [100, 125, 200, 150, 225, 250])plt.plot(x, [150, 220, 250, 300, 200, 150])plt.plot(x, [200, 150, 275, 175, 250, 300])plt.title(\"Custom Styles Demonstration Chart\", y=1.06)plt.show()\n```\n\n![Image 7 - Test chart \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/09/1VYAD3c8AW1Rw3pPwaoySCg.png)\nImage 7 - Test chart (image by author)\nAnd there it is - a completely custom visualization style just one line of code away.\n## Wrapping up\nTo conclude, default data visualization themes suck.\nYou should do everything in your power to make your visuals stand out and capture attention. If you fail to do so, the quality of your message won't matter. No one will look at it for more than a second. No one will share it.\nCustom style sheets in Matplotlib are a great way to capture attention.\nYou only have to write your theme once, and then use it anywhere with one additional line of code. It's a lot less friction than pasting dozens of `rcParams` to every Python script or notebook.\n_Which style tweaks do you typically include in your visualizations?_ Let me know in the comment section below.\n* * *\n[_Looking to level up your data visualization game? Join thousands of like-minded people on my Substack for expert tips and exclusive content._](https://darioradecic.substack.com/)\n> [**Data Doodles with Python | Dario Radecic | Substack**](http://darioradecic.substack.com)\n_Originally published at_[ _https://darioradecic.substack.com_](https://darioradecic.substack.com/p/how-to-create-a-custom-matplotlib) _._\n* * *\n![](https://assets.insightmediagroup.io/media/1787657095692_93hujy.png)\nWritten By\n## [Dario Radečić](https://towardsdatascience.com/author/radecicdario/)\nhttps://writingfordevs.substack.com\n[See all from Dario Radečić](https://towardsdatascience.com/author/radecicdario/)\n[Data Science](https://towardsdatascience.com/tag/data-science/)[Data Visualization](https://towardsdatascience.com/tag/data-visualization/)[Matplotlib](https://towardsdatascience.com/tag/matplotlib/)[Programming](https://towardsdatascience.com/tag/programming/)[Python](https://towardsdatascience.com/tag/python/)\nShare This Article\n  * [](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Ftowardsdatascience.com%2Fhow-to-create-a-custom-matplotlib-theme-and-make-your-charts-go-from-boring-to-amazing-bb2998945c8f%2F&title=How%20to%20Create%20a%20Custom%20Matplotlib%20Theme%20and%20Make%20Your%20Charts%20Go%20from%20Boring%20to%20Amazing)\n  * [](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Ftowardsdatascience.com%2Fhow-to-create-a-custom-matplotlib-theme-and-make-your-charts-go-from-boring-to-amazing-bb2998945c8f%2F&title=How%20to%20Create%20a%20Custom%20Matplotlib%20Theme%20and%20Make%20Your%20Charts%20Go%20from%20Boring%20to%20Amazing)\n  * [](https://x.com/share?url=https%3A%2F%2Ftowardsdatascience.com%2Fhow-to-create-a-custom-matplotlib-theme-and-make-your-charts-go-from-boring-to-amazing-bb2998945c8f%2F&text=How%20to%20Create%20a%20Custom%20Matplotlib%20Theme%20and%20Make%20Your%20Charts%20Go%20from%20Boring%20to%20Amazing)\n\n\nTowards Data Science is a community publication. Submit your insights to reach our global audience and earn through the TDS Author Payment Program.\n[Write for TDS](https://towardsdatascience.com/submissions/)\n## Related Articles\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2021/10/0Y0zYenZ8ZkBwTfrE-scaled.jpg)](https://towardsdatascience.com/how-to-decide-the-perfect-distance-metric-for-your-machine-learning-model-2fa6e5810f11/)\n## [How to decide the perfect distance metric for your machine learning model](https://towardsdatascience.com/how-to-decide-the-perfect-distance-metric-for-your-machine-learning-model-2fa6e5810f11/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nEver had a doubt about which distance metric would be most beneficial for your use case?\n[Harsh Maheshwari](https://towardsdatascience.com/author/anveenaik/)\nOctober 13, 20217 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2021/10/1n9qOLCK3ZUzMC-TCwej-6Q.jpeg)](https://towardsdatascience.com/building-bigots-81da1021f8eb/)\n## [Building Bigots](https://towardsdatascience.com/building-bigots-81da1021f8eb/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nWhy AI Needs a Social Psychology Of, And What it Might Look Like\n[Brandon Cosley](https://towardsdatascience.com/author/brandoncosley/)\nOctober 13, 202110 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/09/1MQjXfXYUcrGYzoCYz_fdIA.jpg)](https://towardsdatascience.com/seven-common-causes-of-data-leakage-in-machine-learning-75f8a6243ea5/)\n## [Seven Common Causes of Data Leakage in Machine Learning](https://towardsdatascience.com/seven-common-causes-of-data-leakage-in-machine-learning-75f8a6243ea5/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nKey Steps in data preprocessing, feature engineering, and train-test splitting to prevent data leakage\n[Yu Dong](https://towardsdatascience.com/author/ydong029/)\nSeptember 14, 20247 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2021/12/1jUMexU3zpd10SkvMzt64oA-scaled.jpeg)](https://towardsdatascience.com/tools-for-efficient-deep-learning-c9585122ded0/)\n## [Tools for Efficient Deep Learning](https://towardsdatascience.com/tools-for-efficient-deep-learning-c9585122ded0/)\n[Deep Learning](https://towardsdatascience.com/category/artificial-intelligence/deep-learning/)\nDeep Learning is fun given the ease of PyTorch and Keras but it can be tiresome too if we don't run experiments efficiently and smartly.\n[Tejasvi Sharma](https://towardsdatascience.com/author/contacttejasvi/)\nAugust 7, 20214 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2021/08/08lltFL55zVSsh8XD-scaled.jpg)](https://towardsdatascience.com/should-you-care-about-the-aspect-ratio-when-creating-line-plots-ed423a5dceb3/)\n## [What aspect ratio to use when creating line plots](https://towardsdatascience.com/should-you-care-about-the-aspect-ratio-when-creating-line-plots-ed423a5dceb3/)\n[Data Visualization](https://towardsdatascience.com/category/data-science/data-visualization/)\nLearn how to create better charts and find hidden insights in time series using appropriate aspect ratios for your line plots.\n[Abhinav Malasi](https://towardsdatascience.com/author/abhinav-malasi/)\nAugust 27, 20216 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2020/12/1dvt4OpFWI2a-YiIc-oZIJw-scaled.jpeg)](https://towardsdatascience.com/observational-vs-experimental-study-543425a3b3c8/)\n## [Observational vs Experimental Study](https://towardsdatascience.com/observational-vs-experimental-study-543425a3b3c8/)\n[Data Science](https://towardsdatascience.com/category/data-science/)\nIs your statistical study observational or experimental? Let us find out.\n[Chetna Khanna](https://towardsdatascience.com/author/chetnakhanna/)\nDecember 5, 20205 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2019/09/0k8W0iFiZrzH3nKNu.jpg)](https://towardsdatascience.com/interview-with-apache-pig-theory-and-practical-guide-6c44f06a4ca9/)\n## [Interview with Apache Pig: Theory and Practical Guide](https://towardsdatascience.com/interview-with-apache-pig-theory-and-practical-guide-6c44f06a4ca9/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\nIn this exclusive interview, Apache Pig spoke about his role in the Hadoop ecosystem and elaborated on his use cases and his differences...\n[Meraldo Antonio](https://towardsdatascience.com/author/meraldo.antonio/)\nSeptember 24, 201915 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2022/08/0ljyW1QItACx67HVd-scaled.jpg)](https://towardsdatascience.com/why-do-we-use-xml-in-data-science-99a730c46adb/)\n## [The Power of XML: Simplifying Data Exchange and Storage](https://towardsdatascience.com/why-do-we-use-xml-in-data-science-99a730c46adb/)\n[Data Science](https://towardsdatascience.com/category/data-science/)\nLearning the basics of XML and how to deal with it in Python\n[Niklas Lang](https://towardsdatascience.com/author/niklas_lang/)\nAugust 20, 20225 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2020/06/132PP8kmeJlmS2AVexbISMA-scaled.jpeg)](https://towardsdatascience.com/can-we-use-deep-learning-to-create-new-programming-languages-c5d7aeb96379/)\n## [Can We Use Deep Learning to Create New Programming Languages?](https://towardsdatascience.com/can-we-use-deep-learning-to-create-new-programming-languages-c5d7aeb96379/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nTransCoder form Facebook AI: Translation between high-level programming languages\n[Soner Yıldırım](https://towardsdatascience.com/author/sonery/)\nJune 11, 20204 min read\n\n\n  * [YouTube](https://www.youtube.com/c/TowardsDataScience)\n  * [X](https://x.com/TDataScience)\n  * [LinkedIn](https://www.linkedin.com/company/towards-data-science/)\n  * [Threads](https://www.threads.net/@towardsdatascience)\n  * [Bluesky](https://bsky.app/profile/towardsdatascience.com)\n\n\n[](https://towardsdatascience.com/)\nYour home for data science and AI. The world's leading publication for data science, data analytics, data engineering, machine learning, and artificial intelligence professionals.\nSubscribe to Our Newsletter[Write For TDS](https://towardsdatascience.com/submissions/)•[About](https://towardsdatascience.com/about-towards-data-science-d691af11cc2f/)•[Advertise](https://contact.towardsdatascience.com/advertise-with-towards-data-science)•[Privacy Policy](https://towardsdatascience.com/privacy-policy/)•[Terms of Use](https://towardsdatascience.com/website-terms-of-use/)\n© Insight Media Group, LLC 2026•[The New Stack](https://thenewstack.io)•[roadmap.sh](https://roadmap.sh)•[Creator Network](https://insightmediagroup.io/creator-network)\n",
  "metadata": {
    "title": "How to Create a Custom Matplotlib Theme and Make Your Charts Go from Boring to Amazing | Towards Data Science",
    "description": "The best part? You'll only have to do this once.",
    "keywords": null,
    "author": "Dario Radečić",
    "og:locale": "en_US",
    "og:type": "article",
    "og:title": "How to Create a Custom Matplotlib Theme and Make Your Charts Go from Boring to Amazing",
    "og:description": "The best part? You'll only have to do this once.",
    "og:url": "https://towardsdatascience.com/how-to-create-a-custom-matplotlib-theme-and-make-your-charts-go-from-boring-to-amazing-bb2998945c8f/",
    "og:site_name": "Towards Data Science",
    "og:image": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/09/11uzg9ZZfplOJIDbQ09B4Zg.png",
    "og:image:width": "1500",
    "og:image:height": "1000",
    "og:image:type": "image/png",
    "twitter:card": "summary_large_image",
    "twitter:site": "@TDataScience",
    "twitter:creator": "@TDataScience",
    "twitter:label1": "Written by",
    "twitter:data1": "Dario Radečić",
    "twitter:label2": "Est. reading time",
    "twitter:data2": "6 min read",
    "article:published_time": "2024-09-05T17:48:23.000Z",
    "article:modified_time": "2024-09-05T17:48:23.000Z",
    "article:author": "https://towardsdatascience.com/author/radecicdario/"
  },
  "paywall": {
    "listed_paid": true,
    "detected": false,
    "marker": "",
    "public_only": true,
    "policy": "付费/会员内容只保留页面公开可见部分，不绕过付费墙"
  },
  "crawl": {
    "success": true,
    "status_code": 200,
    "error": ""
  },
  "code_blocks": [
    {
      "language": "txt",
      "file": "attachments/5e51b93518d0/code/block_000.txt",
      "chars": 74
    },
    {
      "language": "txt",
      "file": "attachments/5e51b93518d0/code/block_001.txt",
      "chars": 648
    },
    {
      "language": "txt",
      "file": "attachments/5e51b93518d0/code/block_002.txt",
      "chars": 585
    },
    {
      "language": "txt",
      "file": "attachments/5e51b93518d0/code/block_003.txt",
      "chars": 62
    },
    {
      "language": "txt",
      "file": "attachments/5e51b93518d0/code/block_004.txt",
      "chars": 731
    },
    {
      "language": "txt",
      "file": "attachments/5e51b93518d0/code/block_005.txt",
      "chars": 33
    },
    {
      "language": "txt",
      "file": "attachments/5e51b93518d0/code/block_006.txt",
      "chars": 22
    },
    {
      "language": "txt",
      "file": "attachments/5e51b93518d0/code/block_007.txt",
      "chars": 13
    },
    {
      "language": "txt",
      "file": "attachments/5e51b93518d0/code/block_008.txt",
      "chars": 135
    },
    {
      "language": "txt",
      "file": "attachments/5e51b93518d0/code/block_009.txt",
      "chars": 51
    },
    {
      "language": "txt",
      "file": "attachments/5e51b93518d0/code/block_010.txt",
      "chars": 30
    },
    {
      "language": "txt",
      "file": "attachments/5e51b93518d0/code/block_011.txt",
      "chars": 294
    }
  ],
  "images": [
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/09/11uzg9ZZfplOJIDbQ09B4Zg.png",
      "alt": "Article thumbnail (image by author)",
      "local_path": "attachments/5e51b93518d0/images/000.png",
      "bytes": 168749,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/09/13UFsOFYX54RrpUUsc2XTGQ.png",
      "alt": "Image 1 - Ugly bar chart (image by author)",
      "local_path": "attachments/5e51b93518d0/images/001.png",
      "bytes": 116780,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/09/1_stux95J3q2zjmeBvCIrmw.png",
      "alt": "Image 2 - Ugly line chart (image by author)",
      "local_path": "attachments/5e51b93518d0/images/002.png",
      "bytes": 317732,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/09/1phsWMO7RNcZULVSqjhf9kA.png",
      "alt": "Image 3 - Pretty bar chart (image by author)",
      "local_path": "attachments/5e51b93518d0/images/003.png",
      "bytes": 208448,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/09/13uNpgcvWuyP6H-eEZr-XHQ.png",
      "alt": "Image 4 - Pretty line chart (image by author)",
      "local_path": "attachments/5e51b93518d0/images/004.png",
      "bytes": 548269,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/09/1XPxw2A5J-xjOcIaSDbve2A.png",
      "alt": "Image 5 - Environment-specific Matplotlib location",
      "local_path": "attachments/5e51b93518d0/images/005.png",
      "bytes": 19592,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/09/18O1QPEjxMwJmK_3hY9VjIg.png",
      "alt": "Image 6 - Available Matplotlib styles (image by author)",
      "local_path": "attachments/5e51b93518d0/images/006.png",
      "bytes": 15555,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/09/1VYAD3c8AW1Rw3pPwaoySCg.png",
      "alt": "Image 7 - Test chart (image by author)",
      "local_path": "attachments/5e51b93518d0/images/007.png",
      "bytes": 316658,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2021/10/0Y0zYenZ8ZkBwTfrE-scaled.jpg",
      "alt": "",
      "local_path": "attachments/5e51b93518d0/images/008.jpg",
      "bytes": 300670,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2021/12/1jUMexU3zpd10SkvMzt64oA-scaled.jpeg",
      "alt": "",
      "local_path": "attachments/5e51b93518d0/images/009.jpeg",
      "bytes": 903132,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2021/08/08lltFL55zVSsh8XD-scaled.jpg",
      "alt": "",
      "local_path": "attachments/5e51b93518d0/images/010.jpg",
      "bytes": 627209,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2020/12/1dvt4OpFWI2a-YiIc-oZIJw-scaled.jpeg",
      "alt": "",
      "local_path": "attachments/5e51b93518d0/images/011.jpeg",
      "bytes": 281513,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2019/09/0k8W0iFiZrzH3nKNu.jpg",
      "alt": "",
      "local_path": "attachments/5e51b93518d0/images/012.jpg",
      "bytes": 102245,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2022/08/0ljyW1QItACx67HVd-scaled.jpg",
      "alt": "",
      "local_path": "attachments/5e51b93518d0/images/013.jpg",
      "bytes": 360289,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2020/06/132PP8kmeJlmS2AVexbISMA-scaled.jpeg",
      "alt": "",
      "local_path": "attachments/5e51b93518d0/images/014.jpeg",
      "bytes": 475400,
      "downloaded": true
    }
  ],
  "audio": [],
  "videos": [
    {
      "src": "https://www.youtube.com/c/TowardsDataScience",
      "quality": "unavailable",
      "local_path": "",
      "note": "无1080p且无720p，未交付更低清晰度"
    }
  ],
  "links": [
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/latest/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/editors-pick/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/the-variable/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/shipai/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/submissions/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/category/data-science/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/radecicdario/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/data-science/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/data-visualization/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/matplotlib/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/programming/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/python/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/how-to-decide-the-perfect-distance-metric-for-your-machine-learning-model-2fa6e5810f11/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/category/artificial-intelligence/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/anveenaik/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/building-bigots-81da1021f8eb/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/brandoncosley/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/seven-common-causes-of-data-leakage-in-machine-learning-75f8a6243ea5/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/ydong029/"
    },
    {
      "type": "external",
      "href": "https://write.insightmediagroup.io"
    },
    {
      "type": "external",
      "href": "https://www.linkedin.com/company/towards-data-science/"
    },
    {
      "type": "external",
      "href": "https://x.com/TDataScience"
    },
    {
      "type": "external",
      "href": "https://darioradecic.substack.com/p/you-need-to-fix-these-3-things-right"
    },
    {
      "type": "external",
      "href": "https://roadmap.sh/ai-data-scientist"
    },
    {
      "type": "external",
      "href": "https://roadmap.sh/computer-science"
    },
    {
      "type": "external",
      "href": "https://roadmap.sh/data-analyst"
    },
    {
      "type": "external",
      "href": "https://matplotlib.org/stable/users/explain/customizing.html"
    },
    {
      "type": "external",
      "href": "https://jrnold.github.io/ggthemes/reference/tableau_color_pal-21.png"
    },
    {
      "type": "external",
      "href": "https://fonts.google.com/specimen/IBM+Plex+Sans?query=ibm+plex+sans"
    },
    {
      "type": "external",
      "href": "https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.grid.html"
    },
    {
      "type": "external",
      "href": "https://darioradecic.substack.com/"
    },
    {
      "type": "external",
      "href": "http://darioradecic.substack.com"
    },
    {
      "type": "external",
      "href": "https://darioradecic.substack.com/p/how-to-create-a-custom-matplotlib"
    },
    {
      "type": "external",
      "href": "https://www.facebook.com/sharer/sharer.php?title=How+to+Create+a+Custom+Matplotlib+Theme+and+Make+Your+Charts+Go+from+Boring+to+Amazing&u=https%3A%2F%2Ftowardsdatascience.com%2Fhow-to-create-a-custom-matplotlib-theme-and-make-your-charts-go-from-boring-to-amazing-bb2998945c8f%2F"
    },
    {
      "type": "external",
      "href": "https://www.linkedin.com/shareArticle?mini=true&title=How+to+Create+a+Custom+Matplotlib+Theme+and+Make+Your+Charts+Go+from+Boring+to+Amazing&url=https%3A%2F%2Ftowardsdatascience.com%2Fhow-to-create-a-custom-matplotlib-theme-and-make-your-charts-go-from-boring-to-amazing-bb2998945c8f%2F"
    },
    {
      "type": "external",
      "href": "https://x.com/share?text=How+to+Create+a+Custom+Matplotlib+Theme+and+Make+Your+Charts+Go+from+Boring+to+Amazing&url=https%3A%2F%2Ftowardsdatascience.com%2Fhow-to-create-a-custom-matplotlib-theme-and-make-your-charts-go-from-boring-to-amazing-bb2998945c8f%2F"
    },
    {
      "type": "external",
      "href": "https://www.youtube.com/c/TowardsDataScience"
    },
    {
      "type": "external",
      "href": "https://www.threads.net/@towardsdatascience"
    },
    {
      "type": "external",
      "href": "https://bsky.app/profile/towardsdatascience.com"
    }
  ],
  "repair_version": 2,
  "repaired_at": "2026-10-14T11:11:48Z",
  "source_url": "https://towardsdatascience.com/how-to-create-a-custom-matplotlib-theme-and-make-your-charts-go-from-boring-to-amazing-bb2998945c8f/",
  "delivery_status": "excluded_paid",
  "discovery_status": "excluded_paid",
  "missing_reason": "按原约定排除付费/会员全文"
}