This notebook demostrates the current capability of the IDL IPython/Jupyter Kernel
a = 1
b = 2
arr = indgen(5)
str = "Hello, World!"
help,a,b,str,arr
A INT = 1 B INT = 2 STR STRING = 'Hello, World!' ARR INT = Array[5]
print,str
Hello, World!
FUNCTION mysin, x
return, sin(x)
END
print, mysin(2)
0.909297
PRO hello_world
print,"Hello, World!"
END
hello_world
Hello, World!
Note that X Window System may not work on a cloud platform such as mybinder.org:
;;This enables inline plotting
!inline=1
set_plot,'x'
x = 2*!PI*0.01*indgen(100)
y1 = sin(x)
y2 = cos(x)
device,decomposed=0 ;;colors will be numbers from 0 to 255, as index in a colortable
loadct,39 ;; only useful if decomposed=0 : this is the colortable chosen.
;; Note: if, as is the default, decomposed=1, colors are way more numerous (16777216!)
;; but must be defined as 'RRGGBB'x where each color component
;; (Red,Green,Blue) can take the 256 values from '00' to 'FF'
window,xsize=800,ysize=500
plot,x,y1,title='Trig Functions',xtitle='Radians',ytitle='Amplitude',xrange=[0,6],charsize=1.5,back=255,color=0
;; the equivalent in 'decomposed mode' would have said: background='FFFFFF'x,color='0'x
oplot,x,y2,color=50
In Z-buffer Device, you may need to choose decomposed=1
to use it on a cloud platform such as mybinder.org:
;;This enables inline plotting
!inline=1
set_plot,'z'
device,decomposed=1, set_resolution=[800,500],set_pixel_depth=24 ;;colors will be numbers from 0 to 255, as index in a colortable
x = 2*!PI*0.01*indgen(100)
y1 = sin(x)
y2 = cos(x)
loadct,14 ;; only useful if decomposed=0 : this is the colortable chosen.
;; Note: if, as is the default, decomposed=1, colors are way more numerous (16777216!)
;; but must be defined as 'RRGGBB'x where each color component
;; (Red,Green,Blue) can take the 256 values from '00' to 'FF'
plot,x,y1,title='Trig Functions',xtitle='Radians',ytitle='Amplitude',xrange=[0,6],charsize=1.5,background='000000'x,color='FFFFFF'x
;; the equivalent in 'decomposed mode' would have said: background='FFFFFF'x,color='0'x
oplot,x,y2,color='FF0000'x
Pixel Depth changes ignored in GDL, stays at 24.
If the plot does not work, you need to compile snapshot.pro
by giving the correct path as follows:
.compile ~/snapshot.pro