Re: Text boxes in plot don't stay where I put them



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.
.



Relevant Pages

  • Re: Matlab -- Venting, Plus Miscellaneous Questions
    ... There are no command lines. ... Matlab is obviously intensively command-driven -- which means, ... print or online documentation. ... calculations, but symbolic calculations keep showing some ridiculous ...
    (sci.math.symbolic)
  • Re: Matlab -- Venting, Plus Miscellaneous Questions
    ... that I am -- I don't want to type in a special command syntax each ... Matlab is obviously intensively command-driven -- which means, ... print or online documentation. ... calculations, but symbolic calculations keep showing some ridiculous ...
    (sci.math.symbolic)
  • Re: [Help] Printing problem in Mac OSX Leopard
    ... I think the issue is that the operating system lpr command (used by MATLAB to send the file to your printer) doesn't recognize the IP address as a printer. ... HP LaserJet 1320 series ...
    (comp.soft-sys.matlab)
  • Re: Matlab -- Venting, Plus Miscellaneous Questions
    ... Matlab is not one of those programs. ... print or online documentation. ... this is a normal double precision computation; no symbolic expressions ... currently highlighted command, rather than autoscrolling to the bottom ...
    (sci.math.symbolic)
  • Re: Pan and Printing
    ... Can you print a file from the command line using the lpr command? ... I'm also using cups, and I have my print command in Pan set to "lp -d lp", ...
    (alt.os.linux.suse)