HPlot-0.2: Example.hs
-- |
--
-- Demonstrates the basic usage of the PlplotCanvas to embed a plot in a Gnome application.
--
module Main where
import Graphics.UI.Gtk
import Graphics.UI.Gtk.Glade
import Graphics.PLplot
main :: IO ()
main = do
initGUI
Just xml <- xmlNew "example.glade"
window1 <- xmlGetWidget xml castToWindow "window1"
-- button <- xmlGetWidget xml castToButton "button1"
onDestroy window1 mainQuit -- ???
canvas <- plplotCanvasNew
plplotCanvasSetSize canvas 1000 600
containerAdd window1 canvas
widgetShowAll window1
runPLplot canvas example
mainGUI
example :: PLplot p => PLplotM p ()
-- example :: PLplotM' ()
example = do
adv 0 -- Advance to first page
col0 15 -- Set color to black
wid 2 -- Set the pen width
vsta -- Set the viewport
wind 0.0 10.0 0.0 10.0 -- Set the window
box "bcnst" 0.0 0 "bcnstv" 0.0 0 -- Set the box
-- bin [] [BinNoExpand]
lab "#<0x10>Мир" "y-axis" "A Simple Plot" -- Draw some labels
-- Draw the line
col0 1 -- Set the pen color
line $ zip [0,1,2,3,4,5,6,7,8,9,10] [0,0.1,0.4,0.9,1.6,2.6,3.6,4.9,6.4,8.1,10]
-- Advancing the page finalizes this plot
adv 0