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

Home » Public Forums » archive » Axis issues, cgSurf and cgContour
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
Axis issues, cgSurf and cgContour [message #90381] Fri, 27 February 2015 10:40 Go to next message
sam.tushaus is currently offline  sam.tushaus
Messages: 14
Registered: February 2015
Junior Member
Hello! I've been attempting to plot contour data and data on a surface using cgContour and cgSurf, respectively. In both cases I've had issues with the axes. The general form of each command is as follows:
cgContour, data, x, y
cgSurf, data, x, y
Unfortunately, actually inserting something for x and y above hasn't been working out for me. In cgContour, I get a jumbled mess of contours that only vaguely resembles the actual data; in cgSurf, I get only a thin cylinder in the middle of the plot. Plotting without using x and y creates the proper plots, but requires forcing my axes, which can be tedious to program when handling large quantities of data and large numbers of plots (which I need to automate).

Does anyone have experience with this issue? Any fixes? I've tried switching x and y, switching the dimensions of my x and y arrays, using vectors vs 2D arrays...but I've gotten nowhere so far.

Thanks for your help!
Re: Axis issues, cgSurf and cgContour [message #90382 is a reply to message #90381] Fri, 27 February 2015 10:48 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
sam.tushaus@gmail.com writes:

> Hello! I've been attempting to plot contour data and data on a surface using cgContour and cgSurf, respectively. In both cases I've had issues with the axes. The general form of each command is as follows:
> cgContour, data, x, y
> cgSurf, data, x, y
> Unfortunately, actually inserting something for x and y above hasn't been working out for me. In cgContour, I get a jumbled mess of contours that only vaguely resembles the actual data; in cgSurf, I get only a thin cylinder in the middle of the plot. Plotting without using x and y creates the proper plots, but requires forcing my axes, which can be tedious to program when handling large quantities of data and large numbers of plots (which I need to automate).
>
> Does anyone have experience with this issue? Any fixes? I've tried switching x and y, switching the dimensions of my x and y arrays, using vectors vs 2D arrays...but I've gotten nowhere so far.

I have no idea what "forcing my axes" means, but if the commands work
when you don't specify X and Y values, I presume this means when you do
provide them you are doing so incorrectly. But, I really can't tell from
the evidence you have presented.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Axis issues, cgSurf and cgContour [message #90384 is a reply to message #90381] Fri, 27 February 2015 11:00 Go to previous messageGo to next message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
On Friday, February 27, 2015 at 1:41:01 PM UTC-5, sam.t...@gmail.com wrote:

> cgContour, data, x, y
> cgSurf, data, x, y
> Unfortunately, actually inserting something for x and y above hasn't been working out for me. In cgContour, I get a jumbled mess of contours that only vaguely resembles the actual data;

If your x,y values are not monotonic, it would screw up the appearance of the contour.

If your x,y values are monotonic try a couple of diagnostic tests:

1. Does cgContour work with a simple example?
IDL> cgcontour,dist(20),indgen(20)+50,indgen(20)-100

2. Try replacing cgContour with Contour and see if you still have the problem
Re: Axis issues, cgSurf and cgContour [message #90385 is a reply to message #90382] Fri, 27 February 2015 11:09 Go to previous messageGo to next message
sam.tushaus is currently offline  sam.tushaus
Messages: 14
Registered: February 2015
Junior Member
On Friday, February 27, 2015 at 12:48:25 PM UTC-6, David Fanning wrote:
>
>
>> Hello! I've been attempting to plot contour data and data on a surface using cgContour and cgSurf, respectively. In both cases I've had issues with the axes. The general form of each command is as follows:
>> cgContour, data, x, y
>> cgSurf, data, x, y
>> Unfortunately, actually inserting something for x and y above hasn't been working out for me. In cgContour, I get a jumbled mess of contours that only vaguely resembles the actual data; in cgSurf, I get only a thin cylinder in the middle of the plot. Plotting without using x and y creates the proper plots, but requires forcing my axes, which can be tedious to program when handling large quantities of data and large numbers of plots (which I need to automate).
>>
>> Does anyone have experience with this issue? Any fixes? I've tried switching x and y, switching the dimensions of my x and y arrays, using vectors vs 2D arrays...but I've gotten nowhere so far.
>
> I have no idea what "forcing my axes" means, but if the commands work
> when you don't specify X and Y values, I presume this means when you do
> provide them you are doing so incorrectly. But, I really can't tell from
> the evidence you have presented.
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")

Sorry - by forcing the axes, I mean that I need to suppress them and then specify axis labels. This can get pretty tedious since I want to automate the process, and I don't often have whole numbers to use on the axis. Here's what I want to plot using cgSurf:

data = elevation [25,320]
x = longitude [25,320]
y = latitude [25,320]

I've tried "cgSurf, data, x, y" and "cgSurf, data, y, x", as well as something to the effect of "cgSurf, data, x[1,*], y[1,*]"...but as I type that out, I'm realizing that I was thinking about it wrong. I needed to do "cgSurf, data, x[*,1], y[1,*]" to match dimensions.

However, I still have issues with cgContour. In that case, I've got:

data = reflectivity [1440,31]
x = time [1440]
y = height [1440,31] (or [31] if I just use one row of data)

I've tried everything I can think of to plot this, but I've had no luck.
Re: Axis issues, cgSurf and cgContour [message #90390 is a reply to message #90385] Fri, 27 February 2015 12:00 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
sam.tushaus@gmail.com writes:

> Sorry - by forcing the axes, I mean that I need to suppress them and then specify axis labels. This can get pretty tedious since I want to automate the process, and I don't often have whole numbers to use on the axis. Here's what I want to plot using cgSurf:
>
> data = elevation [25,320]
> x = longitude [25,320]
> y = latitude [25,320]
>
> I've tried "cgSurf, data, x, y" and "cgSurf, data, y, x", as well as something to the effect of "cgSurf, data, x[1,*], y[1,*]"...but as I type that out, I'm realizing that I was thinking about it wrong. I needed to do "cgSurf, data, x[*,1], y[1,*]" to match dimensions.
>
> However, I still have issues with cgContour. In that case, I've got:
>
> data = reflectivity [1440,31]
> x = time [1440]
> y = height [1440,31] (or [31] if I just use one row of data)
>
> I've tried everything I can think of to plot this, but I've had no luck.

Are you sure your [31] array is a row vector and not a column vector
[1,31], which would NOT work. That seems to be the simplest explanation,
because what you SAY you are doing would work perfectly well. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Axis issues, cgSurf and cgContour [message #90397 is a reply to message #90381] Fri, 27 February 2015 14:05 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
sam.tushaus@gmail.com writes:

> Unfortunately no luck to that end, I just get a plot that looks striated and constant in x.

Well, my gut tells me there is nothing wrong with the code. It has been
working for people for over 25 years. We would have heard about it by
now if there was a problem.

I'm guessing you are making assumptions about your data that are just
not true. I'd start questioning and testing everything, so you are
certain you know what you are doing.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Principle Componets Analysis
Next Topic: CgTaylorDiagram

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

Current Time: Wed Oct 08 09:19:04 PDT 2025

Total time taken to generate the page: 0.00571 seconds