Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Axis label get cut off when exporting the plot as an image #718

Closed
JodokF opened this issue Jan 30, 2025 · 3 comments
Closed

Axis label get cut off when exporting the plot as an image #718

JodokF opened this issue Jan 30, 2025 · 3 comments

Comments

@JodokF
Copy link

JodokF commented Jan 30, 2025

Description
Just a little bug but when exporting a 3D plot of the trajectory, the axis labeling gets cut off. Could this bug be a consequence of update #700? I hope I didn’t just overlook a setting or another stupidly simple solution.

Danke dir im Voraus!

Command:

evo_traj bag -p reference_traj_2025-01-29-19-31-01.bag /reference_traj

See z-axis label on the right side of this exported image.

Image

  • evo version: 1.30.4
  • Python version: 3.8.10
  • operating system and version: Ubuntu 20.04
  • did you change the source code? no
  • output of evo_config show --brief --no_color:
{
    "console_logging_format": "%(message)s",
    "euler_angle_sequence": "sxyz",
    "global_logfile_enabled": false,
    "map_tile_api_token": "",
    "map_tile_provider": "OpenStreetMap.Mapnik",
    "plot_axis_marker_scale": 0.0,
    "plot_backend": "Qt5Agg",
    "plot_figsize": [
        6,
        6
    ],
    "plot_fontfamily": "sans-serif",
    "plot_fontscale": 1.0,
    "plot_invert_xaxis": false,
    "plot_invert_yaxis": false,
    "plot_legend_loc": "best",
    "plot_linewidth": 1.5,
    "plot_mode_default": "xyz",
    "plot_multi_cmap": "none",
    "plot_pose_correspondences": false,
    "plot_pose_correspondences_linestyle": "dotted",
    "plot_reference_alpha": 0.5,
    "plot_reference_axis_marker_scale": 0.0,
    "plot_reference_color": "black",
    "plot_reference_linestyle": "--",
    "plot_seaborn_enabled": true,
    "plot_seaborn_palette": "deep6",
    "plot_seaborn_style": "darkgrid",
    "plot_show_axis": true,
    "plot_show_legend": true,
    "plot_split": false,
    "plot_start_end_markers": false,
    "plot_statistics": [
        "rmse",
        "median",
        "mean",
        "std",
        "min",
        "max"
    ],
    "plot_texsystem": "pdflatex",
    "plot_trajectory_alpha": 0.75,
    "plot_trajectory_cmap": "jet",
    "plot_trajectory_length_unit": "m",
    "plot_trajectory_linestyle": "-",
    "plot_usetex": false,
    "plot_xyz_realistic": true,
    "pygments_style": "monokai",
    "ros_map_alpha_value": 1.0,
    "ros_map_cmap": "Greys_r",
    "ros_map_enable_masking": true,
    "ros_map_unknown_cell_value": 205,
    "ros_map_viewport": "keep_unchanged",
    "save_traj_in_zip": false,
    "table_export_data": "stats",
    "table_export_format": "csv",
    "table_export_transpose": true,
    "tf_cache_lookup_frequency": 10,
    "tf_cache_max_time": 10000.0
}

MichaelGrupp added a commit that referenced this issue Feb 2, 2025
This allows to keep the constrained layout (PR #703), which
unfortunately is a bit broken with 3D plots...

See issue #718.
@MichaelGrupp
Copy link
Owner

MichaelGrupp commented Feb 2, 2025

It seems the problem here is rather that the tight bounding box setting introduced in #703 doesn't work well out of the box with 3D axis. The constrained layout from #700 doesn't cause the clipping (did a quick test removing the only tight bbox, and then it wasn't clipped).

Since I'd like to keep the tight bbox to avoid blank space (see #701), it would be good to find some way to work around this. Options that would work:

  • Don't set "savefig.bbox": "tight", globally but only when saving a 2D axis.
    • 👎 only useful for --save_plot (PlotCollection.export())
    • 👎 won't be used when saving plots are saved interactively with the save button from a plot window (implemented in matplotlib, not here)
  • Add padding using rcParams["savefig.pad_inches"].
    • 👍 can help when value is set correctly
    • 👎 magic number, probably highly dependent on figure size etc
    • 👎 adds padding around 2D plots that would be fine without it
  • Zoom out a little when creating a 3D axis via ax.set_box_aspect(None, zoom=0.9)
    • 👍 only touches the 3D axis, 2D plots not affected
    • 👎 magic number, not sure if it helps in all cases

So there seems to be no really perfect solution, at least to my knowledge right now. But I would tend to go for the zoom option (configurable), as it's the least bad of the three 😄

Image
Image

Image
Image

MichaelGrupp added a commit that referenced this issue Feb 2, 2025
This allows to keep the constrained layout (PR #703), which
unfortunately is a bit broken with 3D plots...

See issue #718.
@MichaelGrupp
Copy link
Owner

Released in v1.30.6

@JodokF
Copy link
Author

JodokF commented Feb 4, 2025

Michael! Thank you very much for taking a look at my problem and helping me here! As you suggested I went for the zoom solution, with a little bit of tweeking it worked just thine!
Once again thank you for the work you are doing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants