Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: Transform a plot into an image

Subject: Transform a plot into an image

From: Dave

Date: 15 May, 2008 22:03:30

Message: 1 of 8

Hi everyone,

I would like to transform a plot into an image.

i've tried:

plot(x,y);
d=getimage(gca)


but it doesnt work

THANKS!

Subject: Re: Transform a plot into an image

From: Nomee

Date: 15 May, 2008 22:32:50

Message: 2 of 8

From Matlab Help
A = getimage(h) returns the first image data contained in the Handle
Graphics object h. h can be a figure, axes, or image. A is identical
to the image CData; it contains the same values and is of the same
class (uint8, uint16, double, or logical) as the image CData. If h is
not an image or does not contain an image, A is empty.

You might be getting A = [] which obviously means an empty matrix.

Try this
d=getimage(gcf)
This will atleast give you handle of current figure (if it has not
been closed).

You may be able to get axis handle by defining an axis before you plot
and then capture that axis. You have not mentioned if you want axis of
figure so I hope gcf will do it for now.

Subject: Re: Transform a plot into an image

From: ImageAnalyst

Date: 16 May, 2008 00:17:13

Message: 3 of 8

On May 15, 6:03=A0pm, Dave <koho...@hotmail.com> wrote:
> Hi everyone,
>
> I would like to transform a plot into an image.
>
> i've tried:
>
> plot(x,y);
> d=3Dgetimage(gca)
>
> but it doesnt work
>
> THANKS!

Try getframe()

Subject: Re: Transform a plot into an image

From: aasim Azooz

Date: 16 May, 2008 10:14:02

Message: 4 of 8

Dave <kohonen@hotmail.com> wrote in message
<33278300.1210889040237.JavaMail.jakarta@nitrogen.mathforum.
org>...
> Hi everyone,
>
> I would like to transform a plot into an image.
>
> i've tried:
>
> plot(x,y);
> d=getimage(gca)
>
>
> but it doesnt work
>
> THANKS!
I usualy do the following
 edit copy figure paste to microsoft power point slide save
as jpeg or tiff .... as you like

Subject: Re: Transform a plot into an image

From: Yumnam Kirani Singh

Date: 16 May, 2008 10:42:41

Message: 5 of 8

From the File menu of the figure window, choose the save as option and save it as bmp, or jpeg etc in any image file format of your choice. Do not think that Matlab does not have options for saving plots as image or figure etc. Just have a little patience and try around, you will find almost all!

Subject: Re: Transform a plot into an image

From: aasim Azooz

Date: 16 May, 2008 18:31:02

Message: 6 of 8

Yumnam Kirani Singh <kirani.singh@gmail.com> wrote in
message
<2591859.1210934591622.JavaMail.jakarta@nitrogen.mathforum.o
rg>...
> From the File menu of the figure window, choose the save
as option and save it as bmp, or jpeg etc in any image file
format of your choice. Do not think that Matlab does not
have options for saving plots as image or figure etc. Just
have a little patience and try around, you will find almost
all!

Thank you for this information. This facility is not
available in matlab6.5 which I prefer for benig faster. I
checked it is included in R2007a which I keep for some
special tasks. This is going to be one of them. Thank you
Aasim Azooz

Subject: Re: Transform a plot into an image

From: Richard Quist

Date: 16 May, 2008 20:27:42

Message: 7 of 8

aasim Azooz wrote:
> Yumnam Kirani Singh <kirani.singh@gmail.com> wrote in
> message
> <2591859.1210934591622.JavaMail.jakarta@nitrogen.mathforum.o
> rg>...
>> From the File menu of the figure window, choose the save
> as option and save it as bmp, or jpeg etc in any image file
> format of your choice. Do not think that Matlab does not
> have options for saving plots as image or figure etc. Just
> have a little patience and try around, you will find almost
> all!
>
> Thank you for this information. This facility is not
> available in matlab6.5 which I prefer for benig faster. I
> checked it is included in R2007a which I keep for some
> special tasks. This is going to be one of them. Thank you
> Aasim Azooz

You can use the figure window's File->Save As... menu option. Change the "Save
As Type:" dropdown selection to "all files" and then type the name of the file
to save to in the "File name:" field. The extension you give for the
filename will control the kind of file created (jpg, emf, png, eps, ... )

There's also a File -> Export menu option on the figure window which lets you
do the same kind of thing

Also see the help for the print and/or saveas commands
--

Richard Quist
Software Developer
The MathWorks, Inc.

Subject: Re: Transform a plot into an image

From: aasim Azooz

Date: 17 May, 2008 07:55:03

Message: 8 of 8

Richard Quist <rquist_nospam@mathworks.com> wrote in
message <g0kqnu$n21$1@fred.mathworks.com>...
> aasim Azooz wrote:
> > Yumnam Kirani Singh <kirani.singh@gmail.com> wrote in
> > message
> >
<2591859.1210934591622.JavaMail.jakarta@nitrogen.mathforum.o
> > rg>...
> >> From the File menu of the figure window, choose the
save
> > as option and save it as bmp, or jpeg etc in any image
file
> > format of your choice. Do not think that Matlab does
not
> > have options for saving plots as image or figure etc.
Just
> > have a little patience and try around, you will find
almost
> > all!
> >
> > Thank you for this information. This facility is not
> > available in matlab6.5 which I prefer for benig faster.
I
> > checked it is included in R2007a which I keep for some
> > special tasks. This is going to be one of them. Thank
you
> > Aasim Azooz
>
> You can use the figure window's File->Save As... menu
option. Change the "Save
> As Type:" dropdown selection to "all files" and then type
the name of the file
> to save to in the "File name:" field. The extension you
give for the
> filename will control the kind of file created (jpg, emf,
png, eps, ... )
>
> There's also a File -> Export menu option on the figure
window which lets you
> do the same kind of thing
>
> Also see the help for the print and/or saveas
commands
> --
>
> Richard Quist
> Software Developer
> The MathWorks, Inc.
Thanks a lot


Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics