Contour plots / ps files [message #22062] |
Sat, 14 October 2000 00:00  |
Simon Webster
Messages: 2 Registered: October 2000
|
Junior Member |
|
|
Hi,
When I create postscript files of filled contour plots using:
IDL> set_plot, 'ps'
IDL> contour, gradav, depth, opac, /irregular, /fill, xrange=[-70,10],
xstyle=1
then the postscript file has 'filled' the area with the highest points
the same colour as the area with the lowest by leaving both blank.
see:
http://users.ox.ac.uk/~sjoh0776/screenshot.gif
http://users.ox.ac.uk/~sjoh0776/contour.ps
How can I force idl to colour both area differently from the background?
thanks in advance for any help,
simon
Sent via Deja.com http://www.deja.com/
Before you buy.
|
|
|
|
Re: contour plots [message #40366 is a reply to message #22062] |
Mon, 09 August 2004 06:15   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Hans Clarke writes:
> I also want to know how to transfer the generated plot to a postscript
> file. Can you help me?
Well, just execute the commands after you have switched
to the PostScript device driver:
thisDevice = !D.Name
Set_Plot, 'PS'
Device, Filename='myplot.ps'
OpenR, lun, 'yourfile.dat', /Get_Lun
rows = File_Lines('yourfile.dat)
header = ''
data = FltArr(3,rows-1)
ReadF, lun, header, data
Free_Lun, lun
f = Reform(data[0,*])
period = Reform(data[1,*])
gamma = Reform(data[2,*])
Contour, gamma, period, f, /Irregular, NLevels=10
Device, /Close_File
Set_Plot, thisDevice
There are lots of things to know about configuring
the PostScript device with the DEVICE command, but
I typically just use my program PSCONFIG to allow
the user to do it interactively. Saves a lot of
wear and tear. :-)
keywords = PSConfig(Cancel=cancelled)
IF cancelled then RETURN
thisDevice = !D.Name
Set_Plot, 'PS'
Device, _Extra=keywords
You can find the programs for PSCONFIG here:
http://www.dfanning.com/programs/psconfig.zip
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: contour plots [message #40370 is a reply to message #22062] |
Mon, 09 August 2004 00:00   |
hans.clarke
Messages: 6 Registered: August 2004
|
Junior Member |
|
|
David Fanning <davidf@dfanning.com> wrote in message news:<MPG.1b7cb14493f27fce989813@news.frii.com>...
> Hans Clarke writes:
>
>> Here is some data, which I have stored in Excel:
>>
>> f Period Gamma
>> 6.8 15.7 0.01
>> 7 9.9 0.04
>> 7.5 6.1 0.17
>> 8 4.8 0.34
>> 8.5 4 0.56
>> 9 3.5 0.81
>> 9.5 3.1 1.12
>> 10 2.9 1.49
>> 10.5 2.6 1.94
>> 11 2.4 2.52
>> 11.5 2.3 3.29
>> 12 2.1 4.39
>> 12.5 2 6.26
>> 13 1.9 11.05
>> 13.3 1.9 37.16
>>
>> I want to plot, for different f surfaces, Period and Gamma. There is
>> probably four times as much data (60 data sets).
>
> Well, assuming you have saved this in a comma
> delimited text file, with the first line a header
> line, and that you plan to contour the gamma
> value and use f as the Y value and period as
> the X value, I would do something like this:
>
> OpenR, lun, 'yourfile.dat', /Get_Lun
> rows = File_Lines('yourfile.dat)
> header = ''
> data = FltArr(3,rows-1)
> ReadF, lun, header, data
> Free_Lun, lun
> f = Reform(data[0,*])
> period = Reform(data[1,*])
> gamma = Reform(data[2,*])
> Contour, gamma, period, f, /Irregular, NLevels=10
>
> That should get you started, I guess. :-)
>
> Cheers,
>
> David
Hi again, David
Can you also tell me how I modify this to see a 2D plot for f vs. gamma?
Thanks
Hans
|
|
|
Re: contour plots [message #40371 is a reply to message #22062] |
Sun, 08 August 2004 23:57   |
hans.clarke
Messages: 6 Registered: August 2004
|
Junior Member |
|
|
David Fanning <davidf@dfanning.com> wrote in message news:<MPG.1b7cb14493f27fce989813@news.frii.com>...
> Hans Clarke writes:
>
>> Here is some data, which I have stored in Excel:
>>
>> f Period Gamma
>> 6.8 15.7 0.01
>> 7 9.9 0.04
>> 7.5 6.1 0.17
>> 8 4.8 0.34
>> 8.5 4 0.56
>> 9 3.5 0.81
>> 9.5 3.1 1.12
>> 10 2.9 1.49
>> 10.5 2.6 1.94
>> 11 2.4 2.52
>> 11.5 2.3 3.29
>> 12 2.1 4.39
>> 12.5 2 6.26
>> 13 1.9 11.05
>> 13.3 1.9 37.16
>>
>> I want to plot, for different f surfaces, Period and Gamma. There is
>> probably four times as much data (60 data sets).
>
> Well, assuming you have saved this in a comma
> delimited text file, with the first line a header
> line, and that you plan to contour the gamma
> value and use f as the Y value and period as
> the X value, I would do something like this:
>
> OpenR, lun, 'yourfile.dat', /Get_Lun
> rows = File_Lines('yourfile.dat)
> header = ''
> data = FltArr(3,rows-1)
> ReadF, lun, header, data
> Free_Lun, lun
> f = Reform(data[0,*])
> period = Reform(data[1,*])
> gamma = Reform(data[2,*])
> Contour, gamma, period, f, /Irregular, NLevels=10
>
> That should get you started, I guess. :-)
>
> Cheers,
>
> David
Hi again. It works, so thanks, David.
I also want to know how to transfer the generated plot to a postscript
file. Can you help me?
Hans
|
|
|
Re: contour plots [message #40378 is a reply to message #22062] |
Sun, 08 August 2004 01:03   |
hans.clarke
Messages: 6 Registered: August 2004
|
Junior Member |
|
|
David Fanning <davidf@dfanning.com> wrote in message news:<MPG.1b7cb14493f27fce989813@news.frii.com>...
> Hans Clarke writes:
>
>> Here is some data, which I have stored in Excel:
>>
>> f Period Gamma
>> 6.8 15.7 0.01
>> 7 9.9 0.04
>> 7.5 6.1 0.17
>> 8 4.8 0.34
>> 8.5 4 0.56
>> 9 3.5 0.81
>> 9.5 3.1 1.12
>> 10 2.9 1.49
>> 10.5 2.6 1.94
>> 11 2.4 2.52
>> 11.5 2.3 3.29
>> 12 2.1 4.39
>> 12.5 2 6.26
>> 13 1.9 11.05
>> 13.3 1.9 37.16
>>
>> I want to plot, for different f surfaces, Period and Gamma. There is
>> probably four times as much data (60 data sets).
>
> Well, assuming you have saved this in a comma
> delimited text file, with the first line a header
> line, and that you plan to contour the gamma
> value and use f as the Y value and period as
> the X value, I would do something like this:
>
> OpenR, lun, 'yourfile.dat', /Get_Lun
> rows = File_Lines('yourfile.dat)
> header = ''
> data = FltArr(3,rows-1)
> ReadF, lun, header, data
> Free_Lun, lun
> f = Reform(data[0,*])
> period = Reform(data[1,*])
> gamma = Reform(data[2,*])
> Contour, gamma, period, f, /Irregular, NLevels=10
>
> That should get you started, I guess. :-)
>
> Cheers,
>
> David
That's great, thanks David
Hans
|
|
|
Re: contour plots [message #40394 is a reply to message #22062] |
Thu, 05 August 2004 21:04   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Hans Clarke writes:
> Here is some data, which I have stored in Excel:
>
> f Period Gamma
> 6.8 15.7 0.01
> 7 9.9 0.04
> 7.5 6.1 0.17
> 8 4.8 0.34
> 8.5 4 0.56
> 9 3.5 0.81
> 9.5 3.1 1.12
> 10 2.9 1.49
> 10.5 2.6 1.94
> 11 2.4 2.52
> 11.5 2.3 3.29
> 12 2.1 4.39
> 12.5 2 6.26
> 13 1.9 11.05
> 13.3 1.9 37.16
>
> I want to plot, for different f surfaces, Period and Gamma. There is
> probably four times as much data (60 data sets).
Well, assuming you have saved this in a comma
delimited text file, with the first line a header
line, and that you plan to contour the gamma
value and use f as the Y value and period as
the X value, I would do something like this:
OpenR, lun, 'yourfile.dat', /Get_Lun
rows = File_Lines('yourfile.dat)
header = ''
data = FltArr(3,rows-1)
ReadF, lun, header, data
Free_Lun, lun
f = Reform(data[0,*])
period = Reform(data[1,*])
gamma = Reform(data[2,*])
Contour, gamma, period, f, /Irregular, NLevels=10
That should get you started, I guess. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: contour plots [message #40396 is a reply to message #22062] |
Thu, 05 August 2004 20:02   |
hans.clarke
Messages: 6 Registered: August 2004
|
Junior Member |
|
|
David Fanning <davidf@dfanning.com> wrote in message news:<MPG.1b7be1818f3c82fe98980b@news.frii.com>...
> Hans Clarke writes:
>
>> I'm new to idl and I have data for variables f, g and h. How do I
>> read the data in for all the variables and then make a contour plot?
>
> You must be one of those guys who don't like
> to read manuals. :-)
>
> But tell us more. The names of your variables
> are, uh, cryptic. What kind of data is this?
> How is it stored on disk? How much data is
> there? Etc, etc.
>
> Alas, programming has more to do with digging
> ditches than it does with magic. :-)
>
> Cheers,
>
> David
Thanks for the reply, David
Here is some data, which I have stored in Excel:
f Period Gamma
6.8 15.7 0.01
7 9.9 0.04
7.5 6.1 0.17
8 4.8 0.34
8.5 4 0.56
9 3.5 0.81
9.5 3.1 1.12
10 2.9 1.49
10.5 2.6 1.94
11 2.4 2.52
11.5 2.3 3.29
12 2.1 4.39
12.5 2 6.26
13 1.9 11.05
13.3 1.9 37.16
I want to plot, for different f surfaces, Period and Gamma. There is
probably four times as much data (60 data sets).
Thanks
Hans
|
|
|
|
|
Re: contour plots [message #40492 is a reply to message #40365] |
Mon, 09 August 2004 21:47  |
hans.clarke
Messages: 6 Registered: August 2004
|
Junior Member |
|
|
David Fanning <davidf@dfanning.com> wrote in message news:<MPG.1b812727ec92d218989818@news.frii.com>...
> Hans Clarke writes:
>
>> Can you also tell me how I modify this to see a 2D plot for f vs. gamma?
>
> Well, I'd try:
>
> Plot, f, gamma
>
> Instead of the contour plot. :-)
>
> Cheers,
>
> David
Hi David.
Sorry, one more question. How can I rewrite the original program to
see a surface plot. I have tried Surface, gamma, period, f etc but it
says I can't use 'Irregular or Nlevels and the array gamma must have 2
dimensions.
I really apprectiate your help
Hans
|
|
|