How do I apply a line style order to an already created and saved .fig file? There are too many plots for me to do this manually.

5 views (last 30 days)
I already know about linestyleorder, defaultaxeslinestyleorder, colororder, nextplot, and replacechildren, but apparently you have to set these before you run plot.
Anybody know if there's an easy way to do this or some workaround? Thanks.
  1 Comment
dpb
dpb on 10 Jul 2014
Probably depends on what, specifically, you're trying to do.
If it's simply redraw the plot with a different color order, retrieve the [x|y]data, modify the defaultaxescolororder property to that desired, then call plot w/ the data. Legends and so on will also need regenerated if do it this big-club manner.
Alternatively, you can retrieve the handles to the line objects and iterate thru and change a color programmatically.
Again, what's the simplest (if there is a simple solution at all) depends on just what it is you're after...

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 10 Jul 2014
Call findobj() to get the handle of the lines. Then use set() to set the line type to a new style. Really though, it's better to just save the data and recreate the plot rather than saving fig files. Why can't you just save the data in a .mat file instead of a .fig file, or for that matter, just create it correctly in the first place before the .fig is ever even saved out?

Community Treasure Hunt

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

Start Hunting!