Add plot module with isotherm, mixture, and selectivity plotting#2
Merged
Add plot module with isotherm, mixture, and selectivity plotting#2
Conversation
Add a new matkit.plot module for visualizing simulation results: - parsers.py: auto-detect JSON format (single-component pressure isotherms vs mixture RH isotherms), auto-discover adsorbate names from data keys, normalize string/float values, handle NaN/Inf - isotherm.py: plot_single_isotherm, plot_mixture_isotherm, plot_selectivity, and unified plot_isotherm with auto-detection - Support multi-file overlay for comparing MOFs or temperatures, with auto-generated temperature labels (e.g. '273 K') - --data-dir option to load all JSON files from a directory - Pretty LaTeX labels for common adsorbates (CO2, N2, H2O, etc.) - CLI: matkit plot isotherm / matkit plot selectivity with options for DPI, figsize, log scale, error bars, fonts, custom labels - matplotlib is an optional dependency: pip install matkit[plot] - 72 new tests covering parsers, plotting, and CLI commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
matkit.plotmodule for visualizing gRASPA/RASPA simulation results with publication-quality plots0.1bar_298K) and mixture RH isotherms (50_RH), with automatic format detectionNew Features
Plot Module (
src/matkit/plot/)parsers.py: JSON format auto-detection, adsorbate/selectivity key discovery, value normalization (handles string/float/NaN/Inf),collect_data_files()for directory-based loadingisotherm.py:plot_single_isotherm(),plot_mixture_isotherm(),plot_selectivity(), and unifiedplot_isotherm()with auto-dispatchCLI Commands
Key Options
--data(multiple) /--data-dir: load files individually or scan a directory--adsorbate: filter which species to plot in mixture data--label: custom legend labels per file--log-x/--log-y: logarithmic axis scales--no-errorbars: omit error bars--figsize,--dpi,--fontsize-*: full control over figure appearanceDependencies
matplotlib>=3.5added as optional dependency under[plot]extra (pip install matkit[plot])Tests
--data-dir)