comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Creating a jpeg file from a colored plot
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Creating a jpeg file from a colored plot [message #78125] Wed, 26 October 2011 21:28
Zhang Bo is currently offline  Zhang Bo
Messages: 22
Registered: October 2011
Junior Member
On Oct 26, 9:17 pm, IDL beginner <moxam...@gmail.com> wrote:
> Hello all,
>
> I have three victors and I want to plot them in a colored plot and
> save them as jpeg image. The three vectors are v1, v2, v3.
>
> I did the following:
>
> Device, decomposed = 0
>
> R = [0, 1, 1, 0, 0]
> G = [0, 1, 0, 1, 0]
> B = [0, 1, 0, 0, 1]
>
> Tvlct, R * 255, G * 255, B * 255
>
> Plot, v1, background = 255, color = 0
> Oplot, v2, color = 2
> Oplot, v3, color = 3
>
> So, I got a colored plot with three lines, v1, v2, v3. After that, I
> wanted to save the plot as jpeg file. Thus, I did the following:
>
> im = tvrd()
>
> Write_jpeg, ‘filename’, im
>
> And the final result was a black and white jpeg image plot with the
> black line only (v1).  My question is that how can I save the plot as
> colored jpeg image with all the plotted vectors.
>
> Your help is appreciated,
>
>
Try this
im = tvrd(/true)
write_jpeg, out_jpg,im,/true
Re: Creating a jpeg file from a colored plot [message #78126 is a reply to message #78125] Wed, 26 October 2011 18:54 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
IDL beginner writes:

>
> Hello all,
>
> I have three victors and I want to plot them in a colored plot and
> save them as jpeg image. The three vectors are v1, v2, v3.
>
> I did the following:
>
> Device, decomposed = 0
>
>
> R = [0, 1, 1, 0, 0]
> G = [0, 1, 0, 1, 0]
> B = [0, 1, 0, 0, 1]
>
> Tvlct, R * 255, G * 255, B * 255
>
> Plot, v1, background = 255, color = 0
> Oplot, v2, color = 2
> Oplot, v3, color = 3
>
> So, I got a colored plot with three lines, v1, v2, v3. After that, I
> wanted to save the plot as jpeg file. Thus, I did the following:
>
> im = tvrd()
>
> Write_jpeg, ?filename?, im
>
> And the final result was a black and white jpeg image plot with the
> black line only (v1). My question is that how can I save the plot as
> colored jpeg image with all the plotted vectors.

I would do this:

void = cgSnapshot(FILENAME='filename', /JPEG)

You can learn more here:

http://www.idlcoyote.com/graphics_tips/coyote_graphics.php

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Creating a jpeg file from a colored plot
Next Topic: Re: expanded area is shown when trying to plot an image on a map

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:56:12 PDT 2025

Total time taken to generate the page: 0.00876 seconds