lammpskit.plotting.DualAxisPlotConfig
- class lammpskit.plotting.DualAxisPlotConfig(alpha=0.55, linewidth=0.1, markersize=5, marker='^', primary_color='tab:red', secondary_color='tab:blue', format='pdf', primary_legend_loc='upper right', secondary_legend_loc='lower right', legend_framealpha=0.75, tight_layout=True, fontsize_title=8, fontsize_labels=8, fontsize_ticks=8, fontsize_legend=8)[source]
Configuration class for dual-axis plots supporting simultaneous visualization of two data series.
Enables comparison of time series data with different units or scales on a single figure. Essential for correlating physical quantities like temperature-displacement or connectivity-time relationships in scientific analysis. Provides independent color control and legend positioning for clear data interpretation.
- alpha
Transparency level for both data series. Range [0.0, 1.0]. Moderate transparency allows underlying grid and axis lines to remain visible.
- Type:
float, default=0.55
- linewidth
Line thickness for both axes data. Thin lines prevent visual dominance of either dataset. Increase for presentation or when clarity is critical.
- Type:
float, default=0.1
- markersize
Marker size for scatter points on both axes. Consistent sizing maintains visual balance between primary and secondary data series.
- Type:
float, default=5
- marker
Marker style for secondary axis (right). Primary axis uses default scatter markers. Options: ‘o’, ‘s’, ‘^’, ‘*’, ‘+’, ‘x’, ‘D’, ‘v’, ‘<’, ‘>’.
- Type:
str, default=’^’
- primary_color
Color for primary (left) y-axis data and axis labels. Matplotlib tab colors provide good contrast. Options: ‘tab:blue’, ‘tab:orange’, ‘tab:green’, etc.
- Type:
str, default=’tab:red’
- secondary_color
Color for secondary (right) y-axis data and axis labels. Should contrast with primary_color for clear visual separation.
- Type:
str, default=’tab:blue’
- format
Output file format. Dual-axis plots benefit from vector formats to maintain text and line clarity at different scales.
- Type:
str, default=’pdf’
- primary_legend_loc
Legend position for primary axis data. Standard matplotlib locations: ‘upper/lower/center’ + ‘left/right/center’, or ‘best’ for automatic.
- Type:
str, default=’upper right’
- secondary_legend_loc
Legend position for secondary axis data. Should not overlap with primary legend. Consider ‘upper left’, ‘lower left’, or ‘center left’.
- Type:
str, default=’lower right’
- legend_framealpha
Background transparency for legend boxes. Range [0.0, 1.0]. Semi-transparent frames prevent complete data occlusion while maintaining readability.
- Type:
float, default=0.75
- tight_layout
Whether to apply matplotlib tight_layout for automatic spacing adjustment. Prevents axis label cutoff in dual-axis configurations.
- Type:
bool, default=True
Notes
Dual-Axis Design Principles: - Color coding clearly distinguishes data series and corresponding axes - Legend positioning prevents data occlusion while maintaining clarity - Consistent marker sizing maintains visual balance between series - Semi-transparent legends allow underlying data visibility
Common Use Cases: - Temperature vs. displacement over time - Connectivity percentage vs. cluster size evolution - Voltage vs. current relationships in device characterization - Statistical metrics vs. physical properties correlation
Performance Considerations: - Dual-axis rendering requires additional matplotlib operations - Legend placement calculations may slow complex figures - Vector output formats recommended for text clarity
Examples
Default configuration for scientific analysis:
>>> config = DualAxisPlotConfig() >>> print(f"Colors: {config.primary_color}, {config.secondary_color}")
Custom color scheme for publication:
>>> config = DualAxisPlotConfig( ... primary_color='tab:green', ... secondary_color='tab:purple', ... primary_legend_loc='upper left', ... secondary_legend_loc='upper right' ... )
High-contrast configuration for presentations:
>>> config = DualAxisPlotConfig( ... alpha=0.9, ... linewidth=0.5, ... markersize=8, ... legend_framealpha=0.9, ... fontsize_title=12, ... fontsize_labels=10 ... )
Minimal styling for technical reports:
>>> config = DualAxisPlotConfig( ... primary_color='black', ... secondary_color='gray', ... tight_layout=True, ... format='eps' ... )
- Parameters:
- __init__(alpha=0.55, linewidth=0.1, markersize=5, marker='^', primary_color='tab:red', secondary_color='tab:blue', format='pdf', primary_legend_loc='upper right', secondary_legend_loc='lower right', legend_framealpha=0.75, tight_layout=True, fontsize_title=8, fontsize_labels=8, fontsize_ticks=8, fontsize_legend=8)
Methods
__init__([alpha, linewidth, markersize, ...])Attributes
- __init__(alpha=0.55, linewidth=0.1, markersize=5, marker='^', primary_color='tab:red', secondary_color='tab:blue', format='pdf', primary_legend_loc='upper right', secondary_legend_loc='lower right', legend_framealpha=0.75, tight_layout=True, fontsize_title=8, fontsize_labels=8, fontsize_ticks=8, fontsize_legend=8)