Unlocking Insights: Visualizing Chemical Thermodynamics Data with Matplotlib

Unlocking Insights: Visualizing Chemical Thermodynamics Data with Matplotlib

Intro

In my recently published international conference article titled "Isobaric Vapor-Liquid Equilibrium of Methyl Salicylate + Ethyl Salicylate and Methyl Salicylate + α-Pinene Binary Systems at 20.0 and 50.0 kPa," I delved into the world of vapor-liquid equilibrium within specific binary systems.

While there may have been hundreds, if not thousands, of research studies in the realm of chemical thermodynamics, one specific difference persists: the absence of particular formatting guidelines for visualizing data within published articles. Amidst this confusion, I remember Matplotlib, an open-source Python-based data visualization library, to resolve my problems.

Matplotlib Logo

I may have personal reasons regarding this choice. Despite recommendations from lecturers and seniors to utilize OriginPro, I was faced with discomfort that led me to seek alternative solutions.

OriginPro Logo
OriginPro UI

OriginPro only comes with a free trial for 21 days (lacks continuity in case I couldn't finish the project in 3 weeks). Also, I wouldn't say I like installing other cracked software on my 4-year-old laptop, as it already endured too many blue screens and viruses. Prior to that, I used to use "highly edited" Microsoft Excel graphs, but even so, the results were not as "crispy" and "sharp" as my lecturers wanted them to be.

Knowing I know a thing or two about Python from the time I learned about data science, specifically on Matplotlib visualization, and luckily have a VS Code with an up-to-date Anaconda Distribution lying around "ready to code" in my start menu, I decided to fully commit to the use of this open-source platform as both a tool to finish my journal article and a personal development "coding project".

So, what is Matplotlib?

Matplotlib is a comprehensive library for creating static, animated, and interactive visualizations in Python, offering a complete toolkit for crafting informative and visually appealing plots. One of which is to generate publication-quality plots.

Examples of Matplotlib Publication-Quality Plots

Why Matplotlib?

One of Matplotlib's greatest strengths lies in its extensive customizability. The possibilities are practically limitless, from tweaking the colors and styles of your graph, adding annotations to your desired place, all the way to creating complex subplot arrangements for your big data sets. This level of control allows you to compose visualizations that effectively communicate your findings. I put a cheat sheet below so you can comprehend the robust visualization flexibility of Matplotlib.

Matplotlib Cheat Sheet
Matplotlib Anatomy of A Figure

Next is its output quality. With support for generating crisp and clear plots with high dpi (pixels per inch), Matplotlib-produced plots are able to comply with the strict requirements of scientific journals. I personally used 300 dpi as a standard for my published paper.

A 300 dpi, 3900 x 1800 Picture of Two VLE Plots

Lastly, even if you're a?Non-Coding Savvy Individual?like myself, working with Matplotlib is actually quite simple. Here's how you can start:

How to learn Matplotlib?

The robust and detailed documentation from Matplotlib's website, countless instructional videos on YouTube, and assistance from AI tools like ChatGPT have been invaluable resources for my desired visualization design.?

I have listed a couple of useful links for you to get started.

Matplotlib — Visualization with Python

Corey Schafer's Matplotlib Tutorial

ChatGPT

Simple Plot Adjustment Question Matplotlib to ChatGPT

Notes:?Suppose you've never installed or are hesitant to install VS Code or Python due to difficulty or your PC computing power limitations. In that case, Google Colab provides an excellent alternative. With its user-friendly interface and the simplicity of Jupyter notebooks, it's more than capable of handling graphs and plots, even with large datasets. Plus, it requires no installation and runs entirely on the cloud, making it accessible from any device with an internet connection.

Google Colab

Start your own "ready to code" environment by clicking the link below.

colab.google

Why should you learn/switch to Matplotlib?

It's free and open source; you don't need to pay (or even install it if you use Google Colab) any fee. Also, it is a platform updated routinely, ensuring users stay at the?bleeding edge?of visualization technology. While paid options may offer certain conveniences, such as pre-built templates or specialized features, Matplotlib's open-source nature empowers users to tailor visualizations precisely to their needs without paying a single penny.?

"Bleeding Edge" 3D and Volumetric Data Plot 1
"Bleeding Edge" 3D and Volumetric Data Plot 2 & 3

This "environment" extends beyond mere cost savings, as researchers/savvy coders are able to delve into the codebase, contribute improvements, and adapt the tool to emerging trends and research requirements. With Matplotlib, users not only access a powerful visualization tool but also become part of a vibrant community driving innovation in scientific visualization.

Lastly, it's?Python-based; you type your code in Python, so any calculation prior to resulting in the data used in a graph can be done in Python with its robust libraries, such as Numpy and Panda. Personally, I haven't done this because my data recording and calculations were all done in Excel. However, doing all calculations from scratch in Python was a better option since most of the calculations done in VLE are recurring calculations that can be misreferred from time to time due to its long formula. It may have been much more complicated to code, but it will reduce the number of miscalculations.

Ln Γk UNIFAC Formula
Lengthy Excel Row for Ln Γk Calculation, Prone to Misrefer and Miscalculation

I have provided you..

To dive deeper into the implementation of Matplotlib for scientific visualizations, I've prepared a sample code on Google Colab based on one of my Isobaric Vapor-Liquid Equilibrium T-x-y Diagrams.

T-x-y graph of the binary system methyl salicylate (1) + ethyl salicylate (2) at 20.0 kPa (a) and 50.0 kPa (b)

You can access the code by the link below.

Chemical Thermodynamics Diagram with Matplotlib

Call to Action!

Ready to harness the power of Matplotlib in your own research endeavors? Explore the wealth of resources available online, from documentation to tutorials and community forums. Join the thriving community of Matplotlib users and unlock new possibilities in data visualization today!

M Ihwan Nur Rifki

Drilling Well Engineer Trainee // Aspen HYSYS Certified User

1 年

Sudah semestinya kapten menjadi panutan????

回复
Fachrizan Bilal Masrur

Flow Assurance Engineer | Process Simulation & Energy Development

1 年

Panutan ????????

回复
Abdul Quddus Al Kahfi

Ethylene Cold Operation Engineer at PT. Chandra Asri Pacific Tbk

1 年

Inspiring!! Matplotlib is very good for data visualization, but plotly will give you more experience in data visualization and I think you should try thermo package for easier and simpler code to calculate VLE for binary mixture.

要查看或添加评论,请登录

I Made Deago Nugra Visesa的更多文章

  • The year 2020, where do I start?

    The year 2020, where do I start?

    First of all, I would like to say that thank god this everlasting, maybe the longest year the human race has ever…

    2 条评论

社区洞察

其他会员也浏览了