Applying parameters of existing figure to new figures

130 views (last 30 days)
AwedBy Matlab
AwedBy Matlab on 15 Dec 2013
Commented: Asieh Daneshi on 2 Oct 2018
Hi everyone
I have a Figure that I spent a lot of time customising the colors, widths, etc, all from the Plot Tools GUI. I then have a script that generates figures, and I would like to be able to apply the formatting of my customised figure to the newly-generated figures.
I tried two things: 1) Generate M-file from my customised figure, then create the new figures using that code. However, that gives some errors when passing the data parameters; the data is in a rather complex format so I'd rather not have to debug these errors
2) (what I thought would be easier) I opened my customised figure and did Export Setup, and saved as a new style, which I then loaded into a new figure. However, no changes were made to the style of the new figure.
Can anyone help? Many thanks!
Asieh Daneshi
Asieh Daneshi on 2 Oct 2018
That is easy! when you did all the changes, using"file> generate code" you can obtain the code that makes your figure. then you can use it to make other figures.

Sign in to comment.

Answers (2)

Matt J
Matt J on 20 Dec 2013
Edited: Matt J on 20 Dec 2013
I guess something like the following might do it,
Matt J
Matt J on 28 Jan 2014
>> docsearch Axes Properties
will lead you to a list of axes properties and similarly for figure properties. Marker color is a line property. Namely, the actual line objects that you place on axes using plotting commands are children of that axes and have their own properties. Each new line you add to a plot must have its individual properties set, either when created or post-modified. AFAIK, there is no axes property that will force all its child lines to have a certain color, marker type, etc...

Sign in to comment.

Sean de Wolski
Sean de Wolski on 28 Jan 2014
Edited: Sean de Wolski on 28 Jan 2014
Use copyobj()
h = figure('color','r','name','Tuesday');
copyobj(h,0) % copy figure to root


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by