Skip to content

Converting MATLAB figures into matplotlib figures? #22

@foreverallama

Description

@foreverallama

With some more observation, I've observed that MATLAB figures can be saved as a variable into MAT-files, which is saved as an object of class matlab.ui.Figure, which can be read using matio.load_from_mat. This leads to an interesting project idea, where one may be able to directly translate MATLAB figures (along with all of the figures' properties) into a matplotlib figure.

I'm not sure if this has any real use case. If you really wanted such interoperability, you would be saving the data instead of the plot, and it really doesn't take much time to redraw a figure from scratch. Nonetheless, this is an interesting project theoretically, and could be looked into.

Additional Context

I've only looked at very simple plots so far, and this will need to be more carefully studied using different types of figures. But so far this is what I've observed with the class matlab.ui.Figure:

Properties

This class has a whole bunch of properties, listed below:

Property Name Description
StoragePosition Object of class matlab.ui.internal.UnitPos
StorageOuterPosition Object of class matlab.ui.internal.UnitPos
PaperPositionStorage Object of class matlab.ui.internal.PaperPositionStorage
PaperTypeStorage Object of class matlab.ui.internal.PaperPositionStorage
SerializableUIContextMenu 0 x 0 object of class matlab.graphics.GraphicsPlaceholder
CurrentAxesMode Enum value: manual
NextPlotMode Enum value: manual
DefaultTools_I Enum value: menusandtoolbar
ScreenPixelsPerInchMode Enum value: manual
TopLevelSerializedObject Enum value: on
BeingDeleted Enum value: off
Internal Boolean flag
Copyable Boolean flag
PointerShapeCData_IS 16 x 16 integer array
PointerShapeHotSpot_IS 1 x 2 integer array
CloseRequestFcn_IS String: closereq
SerializableApplicationData Empty struct
CustomThemePropertyMappings Empty struct
SerializableTheme Struct array with field ThemeMode
SerializableChildren Object of class matlab.graphics.axis.Axes (contains the actual plot data)

Metadata

Metadata

Assignees

Labels

exploratoryWorth poking around, try stuff and see what happenshelp wantedExtra attention is needed

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions