1
votes

I'm plotting a spectrogram in Matlab and have been editing the axis properties, colormap, and a few other things manually by hand in the Figures editor ("Edit > Colormap or Axis Properties...").

Is there a way to generate/view the code that is creating the plots from the Figure Editor? I could/should dig around some more to see what the calls are to show/fix the color bar and the color map, but it would be really nice to just see the code exactly how I've edited it through the Figure editor. Is this possible?

1
There are many commands you can use to edit a figure. Can you give us a list of things that you're modifying to the figure? That way, we / I can provide you a command for each thing you're trying to edit.rayryeng
It is easier to use figure editor to make the plot look as expected. blogs.mathworks.com/community/2010/04/19/reproducing-figures Here is a possible way to generate code from the plot. However, the only guaranteed way I can think of to get the exact and most efficient code is by human typing. You can use google (or, of course, stackoverflow) to search for methods for different needs.Yvon
@Yvon - Ah yes. I forgot that you can generate a M-File for a figure. Nicely done!rayryeng
Instead of "playing around" in the figure editor, you could also inspect(your_figure_handle) or inspect(your_axes_handle) to get a list of all properties. You can edit them and you directly see what have changed. And later on you can just do the same by set(handle,property,newValue).Robert Seifert

1 Answers

2
votes

In the editing menu you can show the code-changes simply by right-clicking into the figure and choosing "Show-M-Code"

enter image description here