Saving edits to a figure
4 views (last 30 days)
Show older comments
Hello,
I am writing a script that ends with opening a window with plots on a figure. Obviously, when I run the script, the figure shows up, but I want to edit the legend in the figure, then save it to where when I run the script again, the figure will open with the legend that I created. My code for plotting is below:
plot([AD1,AD2],[Angle1,Angle2],[AD3,AD4],[Angle1,Angle2],[Ma1,Ma2],...
[Angle1,Angle2])
title('Baseline vs. Modified Mechanism')
xlabel('Length of AD (mm)')
ylabel('Angle at Point B (Degrees)')
saveas(gcf,'MechanismFigure.png');
I tried to enter the last line of code into the command window to save the figure, but that doesn't work.
Any help or advice would be greatly appreciated!
0 Comments
Answers (1)
Walter Roberson
on 28 Jul 2020
If you want the change to show up when you open the figure again, then you will have to save to the figure, which would be the .fig file not a .png .
If you have an existing image file such as .png file, that already has text "burned into it" as part of the image, then your approach will not work to change the text. You would have to write background color into the image array in where the old text was, and then write the new text into the array, such as using Computer Vision insertText() . And then you would save the image array back to image file.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!