Skip to content

Align axes across stacked plots #4

@phfix

Description

@phfix

Summary

Stacked plots can become visually misaligned when different plots need different amounts of space for axis labels.

Examples:

  • vertically stacked plots with different Y-axis label widths
  • horizontally stacked plots with different X-axis label heights or date/time labels

This causes the plot canvases to start at different positions, making cross-plot comparison harder.

Expected behavior

When plots are stacked in the same plot container, their canvases should align even if their axis labels have different extents.

This should work for:

  • vertical stacking: align the left Y-axis extent so X-axis start positions match
  • horizontal stacking: align the bottom X-axis extent so plot areas line up vertically

Proposed behavior

Use one user-facing option to enable/disable axis alignment across stacked plots.

Suggested behavior:

  • enabled by default
  • applies within the same stacked plot container/tab
  • uses the maximum required axis extent among sibling plots
  • applies to both left Y-axis and bottom X-axis layout extents

Motivation

Without alignment, stacked plots with different axis label sizes look uneven and make it harder to compare events at the same time position across plots.

Possible implementation approach

  • measure the natural extent of each plot's left and bottom axes
  • compute the maximum extent across the container
  • apply that as the minimum extent for sibling plots before replotting
  • expose a single preference flag such as align_axes

Affected areas

  • plotjuggler_app/plot_docker.cpp
  • plotjuggler_base/include/PlotJuggler/plotwidget_base.h
  • plotjuggler_base/src/plotwidget_base.cpp
  • plotjuggler_app/preferences_dialog.cpp
  • plotjuggler_app/preferences_dialog.ui

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions