Re: Text boxes in plot don't stay where I put them
- From: Richard Quist <rquist_nospam@xxxxxxxxxxxxx>
- Date: Tue, 12 Feb 2008 08:17:50 -0500
Matthew wrote:
Eric, Skeptic,
I am brand new to Matlab so I don't understand everything you told me. Skeptic asked if I created the figure in GUIDE. I'm not sure. All I know is that I opened an M-
file and typed the following and the plot appeared.
t = 0:.1:20;
x = 981/40000.*t-2943/16000000+2943/16000000.*exp(-
400/3.*t);
plot(t,x)
I'm not sure what you mean by checking the units properties Skeptic since I'm new to Matlab.
Eric, I followed your PowerPoint export suggestion. That just seemed to create another fig file. What's the objective behind doing that? What does it correct?
Eric, I have no idea what you were talking about with "command window style exporting of the figure as an image file." As I said, I'm new to Matlab and I couldn't follow what you were saying. I couldn't follow the code you typed for it either. Could you explain it on a little more elementary level? :)
I appreciate your help.
Matt Ridzon
The "command window style of exporting" means to use either the saveas command or (my preference) the print command from the MATLAB command window (the same place where you typed in the above code to get your plot to appear).
The print command has lots of options and is used to generate both hardcopy (printed) output as well as to create files of various output formats (bitmap, postscript, etc). You can use the help print command and the online doc to learn about it
The most likely thing that's happening when you print your figure is that (behind the scenes) the figure is being resized to fit the output size (look at the doc for help on the figure and its paperpositionmode, paperposition, and paperunits properties). To prevent this resizing try the following, from the MATLAB command window after you've created your plot:
set(gcf, 'PaperPositionMode', 'auto');
print(gcf, '-djpeg', '-r0', 'test.jpg')
If you have more than one figure window/plot opened then you will either need to click on the plot you want to print before entering those commands or, if you saved the handle of the figure in some variable, for ex. fig, you can use that variable in place of gcf in the above commands.
-djpeg in the print command specifies the kind of output to create - a jpeg file, in this case. Other options are available and the doc can help you with selecting those
-r0 says to print/export at the screen resolution
Setting the PaperPositionMode is 'sticky' - it will remain as auto (which tells MATLAB to ignore the PaperPosition property and use the figure's on-screen size as the printed/exported output size) until you either reset it to 'manual' or explicitly set the PaperPosition property of the figure
HTH
--
Richard Quist
Software Developer
The MathWorks, Inc.
.
- References:
- Text boxes in plot don't stay where I put them
- From: Matthew
- Re: Text boxes in plot don't stay where I put them
- From: Eric
- Re: Text boxes in plot don't stay where I put them
- From: Matthew
- Text boxes in plot don't stay where I put them
- Prev by Date: Gradient Descent using Matlab?
- Next by Date: Re: single precision versus double precision speed
- Previous by thread: Re: Text boxes in plot don't stay where I put them
- Next by thread: Re: Text boxes in plot don't stay where I put them
- Index(es):
Relevant Pages
|