Plots: Designing and Saving
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
How can I include code in my M-File that builds a plot of my data with the following properties:
- grid on
- a vertical line at data point 10 running from the min to max y limits
- title
- xlabel and ylabels
I then want to be able to save this plot as an image with something like:
saveas(graph, 'graph.tiff');
Many thanks for any help you are able to give me!
0 Kommentare
Akzeptierte Antwort
R Strange
am 14 Mai 2011
clc clear all clf
xLimits = [10 10]; %Set x limits here
yLimits = [-10 10]; %Set y limits here
hold
figL = line(xLimits, yLimits);
grid on %Turns major x and y grids on for plot
title('Put Title here') %Title Placement
xlabel('Put X Axis Label here') %x-axis label
ylabel('Put Y axis Label Here') %y-axis label
hold off
hfig = (gcf); %get plot handle
saveas(hfig, 'myGraphImage.tiff') %saves plot as an image in your current workspace dir
Weitere Antworten (1)
Robert Cumming
am 14 Mai 2011
help grid
help ylim %use this to get y limits so you can plot ( [10 10], [ymin ymax] )
help title
help xlabel
help ylabel
Siehe auch
Kategorien
Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!