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

Home » Public Forums » archive » Interpolation problem in 'cgimage.pro' while having set_plot='ps'
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
Interpolation problem in 'cgimage.pro' while having set_plot='ps' [message #86740] Sat, 30 November 2013 08:26 Go to next message
jacobsvensmark is currently offline  jacobsvensmark
Messages: 7
Registered: October 2013
Junior Member
So I execute the following code displaying 3 colored 7x7 array images, and the .eps file that is created has its displayed data smoothed/interpolated, even though I specify interpolate=0. If i set_plot,'X' and comment out the device commands, the displayed image is not interpolated and is thus fine. I wish to not have interpolation - am I doing something wrong or am I seeing a bug?


EXAMPLE using set_plot,'ps':
http://imgur.com/LpzRVmD

EXAMPLE using set_plot,'X' and no device commands
http://imgur.com/s8c8uX6


CODE EXAMPLE:

pro test
set_plot,'ps'

; Example data
data_1 = findgen(7,7)
data_2 = findgen(7,7)+2
data_3 = findgen(7,7)+3

device,filename='plot5.eps',/encapsul,/color

cgDisplay

maxdensity = max([data_1,data_2,data_3])
mindensity = min([data_1,data_2,data_3])
!p.multi=[0,3,1]


cgloadct, 33
tvlct, rr, gg, bb, /get

palette = [ [rr], [gg], [bb] ]
axes_settings = {xticks:6,xtickname:['0','15','30','45','60','75','90'],xtic kv:[0,15,30,45,60,75,90],$
yticks:6,ytickname:['0','15','30','45','60','75','90'],ytick v:[0,15,30,45,60,75,90]}

; PLOT 1
ff = data_1
scaleddensity = bytscl(ff, min=mindensity, max=maxdensity)
; display the density plot.
cgimage, scaleddensity, /axes, palette=palette, axkeywords=axes_settings, $
xtitle='Theta', ytitle='Phi', title = 'Bias at 1 Rvir', xrange=[-7.5,97.5],yrange=[-7.5,97.5],$
position=[0.125, 0.125, 0.9, 0.7],color=cgcolor('black'),interpolate=0
cgcontour, ff, levels=(max(ff)-min(ff))*(findgen(6)+1.)/6.+min(ff), /onimage, $
c_colors=['black'] , $
c_thick=thick, c_charthick=thick

; PLOT 2
ff = data_2
scaleddensity = bytscl(ff, min=mindensity, max=maxdensity)
; display the density plot.
cgimage, scaleddensity, /axes, palette=palette,axkeywords=axes_settings, $
xtitle='Theta', ytitle='Phi', title = 'Bias at 2 Rvir', xrange=[-7.5,97.5],yrange=[-7.5,97.5],$
position=[0.125, 0.125, 0.9, 0.7],color=cgcolor('black'),interpolate=0

cgcontour, ff, levels=(max(ff)-min(ff))*(findgen(6)+1.)/6.+min(ff), /onimage, $
c_colors=['black'] , $
c_thick=thick, c_charthick=thick

; PLOT 3
ff = data_3
scaleddensity = bytscl(ff, min=mindensity, max=maxdensity)
; display the density plot.
cgimage, scaleddensity, /axes, palette=palette, axkeywords=axes_settings, $
xtitle='Theta', ytitle='Phi', title = 'Bias at 3 Rvir', xrange=[-7.5,97.5],yrange=[-7.5,97.5], $
position=[0.125, 0.125, 0.9, 0.7],color=cgcolor('black'),interpolate=0
cgcontour, ff, levels=(max(ff)-min(ff))*(findgen(6)+1.)/6.+min(ff), /onimage, $
c_colors=['black'] , $
c_thick=thick, c_charthick=thick

; PLOT COLORBAR
cgColorbar, Position=[0.125, 0.85, 0.9, 0.925], Title='M!dellipsoid!n(<R)/M!drandom!n(<R)', $
Range=[mindensity, maxDensity], NColors=254, Bottom=1, OOB_Low='gray', $
TLocation='Top',color=cgcolor('black')


device,/close
end
Re: Interpolation problem in 'cgimage.pro' while having set_plot='ps' [message #86741 is a reply to message #86740] Sat, 30 November 2013 08:49 Go to previous messageGo to next message
jacobsvensmark is currently offline  jacobsvensmark
Messages: 7
Registered: October 2013
Junior Member
Oh and for good measure, I am using IDL 7.0 on OSX. Thanks.
Re: Interpolation problem in 'cgimage.pro' while having set_plot='ps' [message #86742 is a reply to message #86741] Sat, 30 November 2013 09:23 Go to previous messageGo to next message
jacobsvensmark is currently offline  jacobsvensmark
Messages: 7
Registered: October 2013
Junior Member
Interesting development: I found out that the interpolation/smoothing takes place as the .eps is opened with the default OSX viewer 'Preview'. The screenshots above are as opened with Preview.

HOWEVER when using the .eps in my LaTeX file it displays just fine, no interpolation. So now I dont really have a problem, even though it might still be a thing to fix.
Re: Interpolation problem in 'cgimage.pro' while having set_plot='ps' [message #86743 is a reply to message #86741] Sat, 30 November 2013 09:29 Go to previous messageGo to next message
Phillip Bitzer is currently offline  Phillip Bitzer
Messages: 223
Registered: June 2006
Senior Member
On Saturday, November 30, 2013 10:49:50 AM UTC-6, jacobsv...@gmail.com wrote:
> Oh and for good measure, I am using IDL 7.0 on OSX. Thanks.

My guess:

http://www.idlcoyote.com/ps_tips/maccolors.php
Re: Interpolation problem in 'cgimage.pro' while having set_plot='ps' [message #86744 is a reply to message #86743] Sat, 30 November 2013 11:12 Go to previous message
jacobsvensmark is currently offline  jacobsvensmark
Messages: 7
Registered: October 2013
Junior Member
On Saturday, November 30, 2013 6:29:24 PM UTC+1, Phillip Bitzer wrote:
> On Saturday, November 30, 2013 10:49:50 AM UTC-6, jacobsv...@gmail.com wrote:
>
>> Oh and for good measure, I am using IDL 7.0 on OSX. Thanks.
>
>
>
> My guess:
>
>
>
> http://www.idlcoyote.com/ps_tips/maccolors.php

Looks exactly like it, thanks for posting.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Updated Coyote Mapping Routines
Next Topic: Simpler Raster Output

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

Current Time: Wed Oct 08 11:45:40 PDT 2025

Total time taken to generate the page: 0.00702 seconds