16 Feb 2017 06:32 AM |
|
Ciao,
I've upgraded from IDL 8.0 to IDL 8.4, and found a strange difference in the behaviour of CONTOUR.
Here's a simple test:
data = RANDOMU(seed, 9, 9)
smooth = CONTOUR(MIN_CURVE_SURF(data), TITLE='Smoothed', RGB_TABLE=1, /FILL, c_value=[0, 0.2, 0.3, 0.5])
If you launch it in IDL 8.0, you get what you (more or less) expect: three filled contours, while the outer part is the white transparent background. I need to include the '0' level, otherwise the inner contour is left blank (BTW, I find it odd, and it is the same for IDL 8.4).
On the other hand, if you launch it in IDL 8.4, there's a big difference: also the outer part is filled! Of course, I can give and explicit white color to it, but it's not the same, because it is not treated as a completely transparent background. So, when you put a contour above another, in IDL 8.0 everything is fine, because the outer part is completely transparent, while in IDL 8.4, you see also this outer part. Using 'max_value=0.5' is not an equivalent solution.
What changed between 8.0 and 8.4? How can I revert to the 8.0 behaviour? I basically want to draw three filled contours, and leave the white transparent background in the rest of the image.
Thanks,
Stefano
|
|
|
|
Deleted User New Member
Posts:5  
17 Feb 2017 02:52 AM |
|
Hi,just to be more specific, this is a plot I had in IDL 8.0:https://img42.com/MOnasand this is what I get (exactly with the same code) in IDL 8.4:https://img42.com/KSkRcAs you can see, in the latter the background of the reddish contour plot is still visible, because it's indeed a filled contour level, while in IDL 8.0 it is simply background. How can I get rid of it?Something clearly changed after IDL 8.0, I hope there's some kind of switch/parameter that I don't understand that can be set to have the old behaviour. I even thought about reconstructing the contour levels polygons, and then fill them, but, apparently, there's no way to get the polygons in function graphics (!?).Thanks,StefanoP.S. I had a chance to test this code on IDL 8.2, and it behaves like 8.4.
|
|
|
|
Deleted User Basic Member
Posts:143  
17 Feb 2017 05:32 PM |
|
This was a change in behavior that occurred around IDL 8.2.3. I think the only workaround is the one you mentioned. Additionally, you can save the image with a transparent background by specifying the background color as transparent. For example:
data = RANDOMU(seed, 9, 9)
cccc = [[255,0,0],[0,255,0],[0,0,255],[0,0,10]]
smooth = CONTOUR(MIN_CURVE_SURF(data), TITLE='Smoothed', c_color=cccc, /FILL, c_value=[0, 0.2, 0.3, 0.5])
smooth.save, "my_image.png", transparent=[0,0,10]
-David
Harris GS
|
|
|
|
Deleted User New Member
Posts:5  
20 Feb 2017 03:50 AM |
|
Hi all,following the precious suggestions of a member from another forum, I found a work-around for the time being: I put the two 8.0 class definition files (idlitviscontour__define.pro and components/idlitviscontourlevel__define.pro) in my working directory, and I can now recover the 'old' results with IDL 8.4, still taking advantages of all the other updates (of course not those for contour...).By the way, I couldn't find another way to re-compile them from my own procedure (.compile does not work inside procedures, and resolve_routine does not accept absolute paths): is there a better way?As a basic debugging to find the differences between the two versions, I found the following as a 'print' output of the contour for the same very script:1. IDL 8.0: N_LEVELS = 4 -- IDL 8.4: N_LEVELS = 0If I include a n_levels=3 keyword in the command line, nothing changes for IDL 8.4 (as expected, the c_values are dominant), while in IDL 8.0 the c_values are ignored (which is not what I would expect). I don't know how this could affect my issue2. If c_value=[level_0,level_1, level_2, level_3], c_color=['blue', 'green', 'red']IDL 8.0: print, smooth.c_color0 0 2550 127 0255 0 0IDL8.4: print, smooth.c_color0 0 2550 127 0255 0 00 0 2550 127 0There are indeed two further colors defined! I think this is why the contours are filled also outside. No matter if I define less colors, alway n+1 colors are stored in c_color (repeated cyclically). In any case, I found the fill contour implementation in IDL counter-intuitive, because it seems to me that it actually fills the outside of the contour, not the inside...Is some IDL developer from Harris actually reading these posts? I think this issue needs an official bugfix. It may well be that the new contour behaviour is more 'correct', but it must be ensured back-compatibility, and, most of all, there must be a way with the new contour to reproduce the kind of plots I did with the old IDL. A transparent contour plot with only some levels on top of another contour plot is a very typical plot in physics.Is there another 'official' channel where I can report this bug?Stefano
|
|
|
|
Deleted User New Member
Posts:5  
20 Feb 2017 06:55 AM |
|
Dear David
thank you for your reply. I realized that the previous links were not working. This is the kind of plot I produce with the old contour:
http://picpaste.com/test_idl80-JsqoYDWK.png
while the new contour produces this one:
http://picpaste.com/test_idl84-GbrmFSaZ.png
I find no way to remove that shadow due to the fact that the new contour fills also the outer level. The transparency option you suggest does not solve the issue, because it is not the image background that needs to be transparent.
I think that the new IDL should still provide a way to produce such a plot (very standard in physics and cosmology), and the solution cannot be to use the old procedures.
Thanks,
Stefano
|
|
|
|