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

Home » Public Forums » archive » Pain with the contour() function
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Pain with the contour() function [message #94497] Wed, 14 June 2017 08:09 Go to previous message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
Hi,
I was trying to plot an image with the contour function and I banged my head against the monitor for a while. I now have the solution and I'm sharing it. Probably most people know this very well. I didn't.
I followed the example given for the colorbar() function (Example: Discrete Contour Levels with Colorbar):
http://www.harrisgeospatial.com/docs/Colorbars.html

So I generated my data with the code below and it appeared strangely shifted to the side.

dis = dist(688)
n_levels = 6
levels = findgen(n_levels)
ct_number = 4
ct_indices = bytscl(levels)
loadct, ct_number, rgb_table=ct, /silent
step_ct = congrid(ct[ct_indices, *], 256, 3)
dis = (n_levels-1)*dis/max(dis)
ii = contour(dis, c_value = levels, rgb_table = step_ct, rgb_indices = ct_indices, /fill, axis_style=0)

I then started playing around with the position and margin keywords, but had no luck. Finally it all comes down to using xRange and yRange (or xStyle=1, yStyle=1):

ii = contour(dis, c_value = levels, rgb_table = step_ct, rgb_indices = ct_indices, /fill, axis_style=0, xStyle=1, yStyle=1)

The reason is that contour() plots images as if they were plots, so it defines some axis around it and you have to make sure you're not having uncovered regions.

Well, back to work.

Cheers,
Helder
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: curved slit
Next Topic: *** Error: checking data fill: tried to move past end of file

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

Current Time: Wed Oct 08 13:07:47 PDT 2025

Total time taken to generate the page: 0.00414 seconds