packages feed

plot 0.2 → 0.2.1

raw patch · 10 files changed

+260/−241 lines, 10 files

Files

CHANGES view
@@ -103,4 +103,8 @@ 		* added `TickFormat` data type  0.2:-		* added `BarSpread`+		* added `BarSetting` with `BarSpread` and `BarStack` 		++0.2.1:+		* don't use textPad when plot title is empty+		* add background colours for figure and plot
lib/Graphics/Rendering/Plot/Defaults.hs view
@@ -75,6 +75,17 @@  ----------------------------------------------------------------------------- +defaultFigureBackgroundColour :: Color+defaultFigureBackgroundColour = white++defaultFigureForegroundColour :: Color+defaultFigureForegroundColour = black++defaultPlotBackgroundColour :: Color+defaultPlotBackgroundColour = white++-----------------------------------------------------------------------------+ defaultBarWidth :: Double defaultBarWidth = 5 @@ -197,7 +208,7 @@ -----------------------------------------------------------------------------  emptyPlot :: PlotData-emptyPlot = Plot False defaultPlotPadding NoText (Ranges (Left (Range Linear (-1) 1)) (Left (Range Linear (-1) 1)))+emptyPlot = Plot False defaultPlotBackgroundColour defaultPlotPadding NoText (Ranges (Left (Range Linear (-1) 1)) (Left (Range Linear (-1) 1)))                  [] BarSpread undefined Nothing []  -----------------------------------------------------------------------------@@ -208,7 +219,7 @@ -----------------------------------------------------------------------------  emptyFigure :: FigureData-emptyFigure = Figure defaultFigurePadding NoText NoText emptyPlots+emptyFigure = Figure defaultFigureBackgroundColour defaultFigurePadding NoText NoText emptyPlots  ----------------------------------------------------------------------------- 
lib/Graphics/Rendering/Plot/Figure.hs view
@@ -35,6 +35,7 @@                                       -- * Figures                                       , newFigure                                       -- ** Formatting+                                      , setBackgroundColour                                       , setFigurePadding                                       , withTitle                                       , withSubTitle@@ -42,6 +43,8 @@                                       , withPlot, withPlots                                         -- * Sub-plots                                       ,  Plot()+                                      -- ** Colour+                                      , setPlotBackgroundColour                                       -- ** Plot elements                                        , Border                                       , setBorder@@ -212,7 +215,7 @@  -- | create a new blank 'Figure' newFigure :: Figure ()-newFigure = putFigure $ Figure defaultFigurePadding NoText NoText+newFigure = putFigure $ Figure defaultFigureBackgroundColour defaultFigurePadding NoText NoText                                (A.listArray ((1,1),(1,1)) [Nothing])  {- newLineFigure :: DataSeries                      -- ^ the y series@@ -234,6 +237,10 @@   -----------------------------------------------------------------------------++-- | set the background colour of the figure+setBackgroundColour :: Color -> Figure ()+setBackgroundColour c = modifyFigure $ \s -> s { _back_clr = c }  -- | set the padding of the figure setFigurePadding :: Double -> Double -> Double -> Double -> Figure ()
lib/Graphics/Rendering/Plot/Figure/Plot.hs view
@@ -17,6 +17,7 @@                                            -- * Plot elements                                             , Border                                            , setBorder+                                           , setPlotBackgroundColour                                            , setPlotPadding                                            , withHeading                                            -- * Series data@@ -113,6 +114,10 @@ -- | whether to draw a boundary around the plot area setBorder :: Border -> Plot () setBorder b = modify $ \s -> s { _border = b }++-- | set the plot background colour+setPlotBackgroundColour :: Color -> Plot ()+setPlotBackgroundColour c = modify $ \s -> s { _back_colr = c }  -- | set the padding of the subplot setPlotPadding :: Double -> Double -> Double -> Double -> Plot ()
lib/Graphics/Rendering/Plot/Render.hs view
@@ -150,10 +150,10 @@ -----------------------------------------------------------------------------  renderFigure :: FigureData -> Render ()-renderFigure (Figure p t s d) = do+renderFigure (Figure b p t s d) = do       cairo $ do              C.save -             C.setSourceRGBA 1 1 1 1+             setColour b              C.paint              C.restore 
lib/Graphics/Rendering/Plot/Render/Plot.hs view
@@ -33,6 +33,8 @@  import qualified Data.Array.IArray as A +import Data.Colour.Names+ import qualified Graphics.Rendering.Cairo as C --import qualified Graphics.Rendering.Pango as P @@ -84,34 +86,25 @@         put bb) (A.assocs d)  renderPlot :: PlotData -> Render ()-renderPlot (Plot b p hd r a bc d l an) = do+renderPlot (Plot b c p hd r a bc d l an) = do   tx <- bbCentreWidth   ty <- bbTopHeight   (_,th) <- renderText hd Centre TTop tx ty-  bbLowerTop (th+textPad)-{- attempt to have different colour plot area-      (BoundingBox x y w h) <- get-      cairo $ do-             setColour white-             C.moveTo x     y-             C.lineTo (x+w) y-             C.lineTo (x+w) (y+h)-             C.lineTo x     (y+h)-             C.stroke-             C.clip-             C.fill-             C.paint--}+  when (th /= 0) $ bbLowerTop (th+textPad)   legend <- renderLegend l d-  padding <- renderAxes p r a+  (axes,padding) <- renderAxes p r a   renderBorder b   cairo C.save   clipBoundary+  when (c /= white) (do+    cairo $ do+      setColour c+      C.paint)   renderData r bc d   renderAnnotations r an   cairo C.restore   legend padding-+  axes renderBorder :: Border -> Render () renderBorder False = return () renderBorder True  = do
lib/Graphics/Rendering/Plot/Render/Plot/Axis.hs view
@@ -107,15 +107,16 @@            else return t1   return $ Padding l r b t -renderAxes :: Padding -> Ranges -> [AxisData] -> Render Padding+renderAxes :: Padding -> Ranges -> [AxisData] -> Render (Render (),Padding) renderAxes p r axes = do   lp <- foldM shiftForAxisLabel (Padding 0 0 0 0) axes   tp <- foldM (shiftForTicks r) (Padding 0 0 0 0) axes   let apd = addPadding lp tp   p' <- isZeroPadding p apd-  mapM_ (renderAxisLabel p') axes-  mapM_ (renderAxis r) axes-  return p'+  return ((do+           mapM_ (renderAxisLabel p') axes+           mapM_ (renderAxis r) axes+         ),p')  shiftForAxisLabel :: Padding -> AxisData -> Render Padding shiftForAxisLabel p (Axis _  _   _ _ _ _ _ NoText) = return p
lib/Graphics/Rendering/Plot/Render/Plot/Legend.hs view
@@ -46,246 +46,242 @@ renderLegend :: Maybe LegendData -> DataSeries -> Render (Padding -> Render ()) renderLegend Nothing                  _ = return $ \_ -> return () renderLegend (Just (Legend b l o to)) d = do-                                          -- calculate row height and max length-                                          let (ln,ls) = getLabels d-                                              mx = maximumBy (\ x y -> length x `compare` length y) $ fst $ unzip ls-                                          pc <- asks _pangocontext-                                          (w,h) <- cairo $ do-                                                           lo <- pango $ P.layoutText pc mx-                                                           setTextOptions to lo-                                                           (_,twh) <- textSize lo Centre Middle 0 0 -                                                           return twh-                                          -- if outside shift bounding box-                                          case o of-                                                 -- render legend-                                                 Outside -> do-                                                            outside <- renderLegendOutside b l w h to ln ls-                                                            return outside-                                                 -- else return (render legend)-                                                 Inside ->  return $ \_ -> renderLegendInside b l w h to ln ls+  -- calculate row height and max length+  let (ln,ls) = getLabels d+      mx = maximumBy (\ x y -> length x `compare` length y) $ fst $ unzip ls+  pc <- asks _pangocontext+  (w,h) <- cairo $ do+     lo <- pango $ P.layoutText pc mx+     setTextOptions to lo+     (_,twh) <- textSize lo Centre Middle 0 0 +     return twh+  -- if outside shift bounding box+  case o of+    -- render legend+    Outside -> do+      outside <- renderLegendOutside b l w h to ln ls+      return outside+    -- else return (render legend)+    Inside ->  return $ \_ -> renderLegendInside b l w h to ln ls  renderLegendOutside :: Bool -> LegendLocation -> Double -> Double -> TextOptions -> Int -> [(SeriesLabel,Decoration)] -> Render (Padding -> Render ()) renderLegendOutside b l w h to ln ls      | l == North                 = do-                                   let h' = textPad + h + textPad-                                   bbLowerTop $ h' + 4*textPad-                                   return $ \(Padding _ _ _ t) -> do-                                             x' <- bbCentreWidth-                                             y' <- bbTopHeight-                                             let w' = (fromIntegral ln)*(textPad + legendSampleWidth -                                                      + legendSampleWidth + textPad + w) + 5*textPad-                                             let x = x'- (w'/2)-                                                 y = y'- h' - t-                                             when b (cairo $ renderBorder 1.0 black (x+0.5) (y+0.5) w' h')-                                             renderLegendEntries (x+3*textPad) (y+textPad) -                                                                 (textPad + legendSampleWidth-                                                                  + legendSampleWidth + textPad -                                                                  + w + textPad) 0 0 h to ls -                                             return ()+       let h' = textPad + h + textPad+       bbLowerTop $ h' + 4*textPad+       return $ \(Padding _ _ _ t) -> do+          x' <- bbCentreWidth+          y' <- bbTopHeight+          let w' = (fromIntegral ln)*(textPad + legendSampleWidth +                    + legendSampleWidth + textPad + w) + 5*textPad+          let x = x'- (w'/2)+              y = y'- h' - t+          when b (cairo $ renderBorder 1.0 black (x+0.5) (y+0.5) w' h')+          renderLegendEntries (x+3*textPad) (y+textPad) +            (textPad + legendSampleWidth + legendSampleWidth + textPad +                     + w + textPad) 0 0 h to ls +          return ()     | l == NorthEast             = do-                                   let h' = textPad + h + textPad-                                   bbLowerTop $ h' + 4*textPad-                                   return $ \(Padding _ _ _ t) -> do-                                             x' <- bbRightWidth-                                             y' <- bbTopHeight-                                             let w' = (fromIntegral ln)*(textPad + legendSampleWidth -                                                      + legendSampleWidth + textPad + w) + 5*textPad-                                             let x = x'- w'-                                                 y = y'- h' - t-                                             when b (cairo $ renderBorder 1.0 black (x+0.5) (y+0.5) w' h')-                                             renderLegendEntries (x+3*textPad) (y+textPad) -                                                                 (textPad + legendSampleWidth-                                                                  + legendSampleWidth + textPad -                                                                  + w + textPad) 0 0 h to ls -                                             return ()+       let h' = textPad + h + textPad+       bbLowerTop $ h' + 4*textPad+       return $ \(Padding _ _ _ t) -> do+          x' <- bbRightWidth+          y' <- bbTopHeight+          let w' = (fromIntegral ln)*(textPad + legendSampleWidth +                    + legendSampleWidth + textPad + w) + 5*textPad+          let x = x'- w'+              y = y'- h' - t+          when b (cairo $ renderBorder 1.0 black (x+0.5) (y+0.5) w' h')+          renderLegendEntries (x+3*textPad) (y+textPad) +            (textPad + legendSampleWidth + legendSampleWidth + textPad +                     + w + textPad) 0 0 h to ls +          return ()     | l == East                  = do-                                   let w' = textPad + legendSampleWidth -                                            + legendSampleWidth + textPad + w + textPad-                                   bbShiftRight $ w' + 4*textPad-                                   return $ \(Padding _ r _ _) -> do-                                             x' <- bbRightWidth-                                             y' <- bbCentreHeight-                                             let h' = (fromIntegral ln)*(h+textPad) + 5*textPad-                                             let x = x' + 4*textPad + r-                                                 y = y'-(h'/2)-                                             when b (cairo $ renderBorder 1.0 black (x+0.5) (y+0.5) w' h')-                                             renderLegendEntries (x+2*textPad) (y+3*textPad) 0 (h+textPad) 0 h to ls -                                             return ()+       let w' = textPad + legendSampleWidth + legendSampleWidth +                        + textPad + w + textPad+       bbShiftRight $ w' + 4*textPad+       return $ \(Padding _ r _ _) -> do+          x' <- bbRightWidth+          y' <- bbCentreHeight+          let h' = (fromIntegral ln)*(h+textPad) + 5*textPad+          let x = x' + 4*textPad + r+              y = y'-(h'/2)+          when b (cairo $ renderBorder 1.0 black (x+0.5) (y+0.5) w' h')+          renderLegendEntries (x+2*textPad) (y+3*textPad) 0 (h+textPad) +             0 h to ls +          return ()     | l == SouthEast             = do-                                   let h' = textPad + h + textPad-                                   bbRaiseBottom $ h' + 4*textPad-                                   return $ \(Padding _ _ b' _) -> do-                                             x' <- bbRightWidth-                                             y' <- bbBottomHeight-                                             let w' = (fromIntegral ln)*(textPad + legendSampleWidth -                                                      + legendSampleWidth + textPad + w) + 5*textPad-                                             let x = x'- w'-                                                 y = y' + b' +textPad-                                             when b (cairo $ renderBorder 1.0 black (x+0.5) (y+0.5) w' h')-                                             renderLegendEntries (x+3*textPad) (y+textPad) -                                                                 (textPad + legendSampleWidth-                                                                  + legendSampleWidth + textPad -                                                                  + w + textPad) 0 0 h to ls -                                             return ()+       let h' = textPad + h + textPad+       bbRaiseBottom $ h' + 4*textPad+       return $ \(Padding _ _ b' _) -> do+          x' <- bbRightWidth+          y' <- bbBottomHeight+          let w' = (fromIntegral ln)*(textPad + legendSampleWidth +                     + legendSampleWidth + textPad + w) + 5*textPad+          let x = x'- w'+              y = y' + b' +textPad+          when b (cairo $ renderBorder 1.0 black (x+0.5) (y+0.5) w' h')+          renderLegendEntries (x+3*textPad) (y+textPad) +            (textPad + legendSampleWidth + legendSampleWidth + textPad +                     + w + textPad) 0 0 h to ls +          return ()     | l == South                 = do-                                   let h' = textPad + h + textPad-                                   bbRaiseBottom $ h' + 4*textPad-                                   return $ \(Padding _ _ b' _) -> do-                                             x' <- bbCentreWidth-                                             y' <- bbBottomHeight-                                             let w' = (fromIntegral ln)*(textPad + legendSampleWidth -                                                      + legendSampleWidth + textPad + w) + 5*textPad-                                             let x = x' - (w'/2)-                                                 y = y' + b' +textPad-                                             when b (cairo $ renderBorder 1.0 black (x+0.5) (y+0.5) w' h')-                                             renderLegendEntries (x+3*textPad) (y+textPad) -                                                                 (textPad + legendSampleWidth-                                                                  + legendSampleWidth + textPad -                                                                  + w + textPad) 0 0 h to ls -                                             return ()+       let h' = textPad + h + textPad+       bbRaiseBottom $ h' + 4*textPad+       return $ \(Padding _ _ b' _) -> do+          x' <- bbCentreWidth+          y' <- bbBottomHeight+          let w' = (fromIntegral ln)*(textPad + legendSampleWidth +                     + legendSampleWidth + textPad + w) + 5*textPad+          let x = x' - (w'/2)+              y = y' + b' +textPad+          when b (cairo $ renderBorder 1.0 black (x+0.5) (y+0.5) w' h')+          renderLegendEntries (x+3*textPad) (y+textPad) +            (textPad + legendSampleWidth + legendSampleWidth + textPad +                     + w + textPad) 0 0 h to ls +          return ()     | l == SouthWest             = do-                                   let h' = textPad + h + textPad-                                   bbRaiseBottom $ h' + 4*textPad-                                   return $ \(Padding _ _ b' _) -> do-                                             x' <- bbLeftWidth-                                             y' <- bbBottomHeight-                                             let w' = (fromIntegral ln)*(textPad + legendSampleWidth -                                                      + legendSampleWidth + textPad + w) + 5*textPad-                                             let x = x'-                                                 y = y' + b' +textPad-                                             when b (cairo $ renderBorder 1.0 black (x+0.5) (y+0.5) w' h')-                                             renderLegendEntries (x+3*textPad) (y+textPad) -                                                                 (textPad + legendSampleWidth-                                                                  + legendSampleWidth + textPad -                                                                  + w + textPad) 0 0 h to ls -                                             return ()+       let h' = textPad + h + textPad+       bbRaiseBottom $ h' + 4*textPad+       return $ \(Padding _ _ b' _) -> do+          x' <- bbLeftWidth+          y' <- bbBottomHeight+          let w' = (fromIntegral ln)*(textPad + legendSampleWidth +                     + legendSampleWidth + textPad + w) + 5*textPad+          let x = x'+              y = y' + b' +textPad+          when b (cairo $ renderBorder 1.0 black (x+0.5) (y+0.5) w' h')+          renderLegendEntries (x+3*textPad) (y+textPad) +             (textPad + legendSampleWidth + legendSampleWidth + textPad +                      + w + textPad) 0 0 h to ls +          return ()     | l == West                   = do-                                    let w' = textPad + legendSampleWidth -                                             + legendSampleWidth + textPad + w + textPad-                                    bbShiftLeft $ w' + 4*textPad-                                    return $ \(Padding l' _ _ _) -> do-                                             x' <- bbLeftWidth-                                             y' <- bbCentreHeight-                                             let h' = (fromIntegral ln)*(h+textPad) + 5*textPad-                                             let x = x' - w' - 4*textPad - l'-                                                 y = y'-(h'/2)-                                             when b (cairo $ renderBorder 1.0 black (x+0.5) (y+0.5) w' h')-                                             renderLegendEntries (x+2*textPad) (y+3*textPad) 0 (h+textPad) 0 h to ls -                                             return ()+       let w' = textPad + legendSampleWidth + legendSampleWidth + textPad +                        + w + textPad+       bbShiftLeft $ w' + 4*textPad+       return $ \(Padding l' _ _ _) -> do+          x' <- bbLeftWidth+          y' <- bbCentreHeight+          let h' = (fromIntegral ln)*(h+textPad) + 5*textPad+          let x = x' - w' - 4*textPad - l'+              y = y'-(h'/2)+          when b (cairo $ renderBorder 1.0 black (x+0.5) (y+0.5) w' h')+          renderLegendEntries (x+2*textPad) (y+3*textPad) 0 (h+textPad) +            0 h to ls +          return ()     | l == NorthWest             = do-                                   let h' = textPad + h + textPad-                                   bbLowerTop $ h' + 4*textPad-                                   return $ \(Padding _ _ _ t) -> do-                                             x' <- bbLeftWidth-                                             y' <- bbTopHeight-                                             let w' = (fromIntegral ln)*(textPad + legendSampleWidth -                                                      + legendSampleWidth + textPad + w) + 5*textPad-                                             let x = x'-                                                 y = y'- h' - t-                                             when b (cairo $ renderBorder 1.0 black (x+0.5) (y+0.5) w' h')-                                             renderLegendEntries (x+3*textPad) (y+textPad) -                                                                 (textPad + legendSampleWidth-                                                                  + legendSampleWidth + textPad -                                                                  + w + textPad) 0 0 h to ls -                                             return ()+       let h' = textPad + h + textPad+       bbLowerTop $ h' + 4*textPad+       return $ \(Padding _ _ _ t) -> do+          x' <- bbLeftWidth+          y' <- bbTopHeight+          let w' = (fromIntegral ln)*(textPad + legendSampleWidth +                     + legendSampleWidth + textPad + w) + 5*textPad+          let x = x'+              y = y'- h' - t+          when b (cairo $ renderBorder 1.0 black (x+0.5) (y+0.5) w' h')+          renderLegendEntries (x+3*textPad) (y+textPad) +            (textPad + legendSampleWidth + legendSampleWidth + textPad +                     + w + textPad) 0 0 h to ls +          return ()  renderBorder :: Double -> Color -> Double -> Double -> Double -> Double -> C.Render () renderBorder lw c x y w h = do-                            C.setLineWidth lw-                            setColour c-                            C.rectangle x y w h-                            C.stroke-                            +  C.setLineWidth lw+  setColour c+  C.rectangle x y w h+  C.stroke  renderLegendInside :: Bool -> LegendLocation -> Double -> Double -> TextOptions -> Int -> [(SeriesLabel,Decoration)] -> Render () renderLegendInside b l w h to ln ls = do-                                      let w' = (textPad + legendSampleWidth -                                                + legendSampleWidth + textPad + w + textPad)-                                          h' = h+textPad-                                          h'' = (fromIntegral ln)*h'+textPad-                                      (x,y) <- case l of-                                                      North     -> do-                                                                   x' <- bbCentreWidth-                                                                   y' <- bbTopHeight-                                                                   return (x'-w'/2-textPad,y'+textPad)-                                                      NorthEast -> do-                                                                   x' <- bbRightWidth-                                                                   y' <- bbTopHeight-                                                                   return (x'-w'-3*textPad,y'+textPad)-                                                      East      -> do-                                                                   x' <- bbRightWidth-                                                                   y' <- bbCentreHeight-                                                                   let y'' = y' - h''/2 -                                                                   return (x'-w'-3*textPad,y''-textPad)-                                                      SouthEast -> do-                                                                   x' <- bbRightWidth-                                                                   y' <- bbBottomHeight-                                                                   let y'' = y' - h''-                                                                   return (x'-w'-3*textPad,y''-3*textPad)-                                                      South    -> do-                                                                   x' <- bbCentreWidth-                                                                   y' <- bbBottomHeight-                                                                   let y'' = y' - h''-                                                                   return (x'-w'/2-textPad,y''-3*textPad)-                                                      SouthWest -> do-                                                                   x' <- bbLeftWidth-                                                                   y' <- bbBottomHeight-                                                                   let y'' = y' - h''-                                                                   return (x'+textPad,y''-3*textPad)-                                                      West      -> do-                                                                   x' <- bbLeftWidth-                                                                   y' <- bbCentreHeight-                                                                   let y'' = y' - h''/2 -                                                                   return (x'+textPad,y''-textPad)-                                                      NorthWest -> do-                                                                   x' <- bbLeftWidth-                                                                   y' <- bbTopHeight-                                                                   return (x'+textPad,y'+textPad)-                                      when b (cairo $ renderBorder 1.0 black (x+0.5) (y+0.5) w' h'')-                                      cairo $ do-                                              --C.setSourceRGBA 1 0 0 0-                                              setColour white-                                              C.rectangle (x+0.5) (y+0.5) w' h''-                                              C.fill-                                              C.stroke-                                      renderLegendEntries (x+3*textPad) (y+textPad) 0 h' w' (h'-textPad) to ls +  let w' = (textPad + legendSampleWidth + legendSampleWidth + textPad +                    + w + textPad)+      h' = h+textPad+      h'' = (fromIntegral ln)*h'+textPad+  (x,y) <- case l of+     North     -> do+       x' <- bbCentreWidth+       y' <- bbTopHeight+       return (x'-w'/2-textPad,y'+textPad)+     NorthEast -> do+       x' <- bbRightWidth+       y' <- bbTopHeight+       return (x'-w'-3*textPad,y'+textPad)+     East      -> do+       x' <- bbRightWidth+       y' <- bbCentreHeight+       let y'' = y' - h''/2 +       return (x'-w'-3*textPad,y''-textPad)+     SouthEast -> do+       x' <- bbRightWidth+       y' <- bbBottomHeight+       let y'' = y' - h''+       return (x'-w'-3*textPad,y''-3*textPad)+     South    -> do+       x' <- bbCentreWidth+       y' <- bbBottomHeight+       let y'' = y' - h''+       return (x'-w'/2-textPad,y''-3*textPad)+     SouthWest -> do+       x' <- bbLeftWidth+       y' <- bbBottomHeight+       let y'' = y' - h''+       return (x'+textPad,y''-3*textPad)+     West      -> do+       x' <- bbLeftWidth+       y' <- bbCentreHeight+       let y'' = y' - h''/2 +       return (x'+textPad,y''-textPad)+     NorthWest -> do+       x' <- bbLeftWidth+       y' <- bbTopHeight+       return (x'+textPad,y'+textPad)+  when b (cairo $ renderBorder 1.0 black (x+0.5) (y+0.5) w' h'')+  cairo $ do+    --C.setSourceRGBA 1 0 0 0+    setColour white+    C.rectangle (x+0.5) (y+0.5) w' h''+    C.fill+    C.stroke+  renderLegendEntries (x+3*textPad) (y+textPad) 0 h' w' +           (h'-textPad) to ls   renderLegendEntries :: Double -> Double -> Double -> Double -> Double -> Double                      -> TextOptions                     -> [(SeriesLabel,Decoration)] -> Render () renderLegendEntries x y wa ha w h to ls = do-                              _ <- foldM (renderLegendEntry wa ha w h to) (x,y) ls-                              return ()+  _ <- foldM (renderLegendEntry wa ha w h to) (x,y) ls+  return ()  renderLegendEntry :: Double -> Double -> Double -> Double -> TextOptions -> (Double,Double) -> (SeriesLabel,Decoration) -> Render (Double,Double) renderLegendEntry wa ha _ h to (x,y) (l,d) = do-                            renderLegendSample x y legendSampleWidth h d-                            pc <- asks _pangocontext-                            cairo $ do-                                    lo <- pango $ P.layoutText pc l-                                    setTextOptions to lo-                                    showText lo (x+legendSampleWidth + 2*textPad) y-                            return (x+wa,y+ha)+  renderLegendSample x y legendSampleWidth h d+  pc <- asks _pangocontext+  cairo $ do+    lo <- pango $ P.layoutText pc l+    setTextOptions to lo+    showText lo (x+legendSampleWidth + 2*textPad) y+  return (x+wa,y+ha)  renderLegendSample :: Double -> Double -> Double -> Double -> Decoration -> Render () renderLegendSample x y w h d = do-                               let l = decorationGetLineType d-                               let p = decorationGetPointType d-                               case l of-                                      Nothing -> return ()-                                      Just l' -> do-                                                 cairo $ do-                                                         setLineStyle l'-                                                         C.moveTo x     (y+h/2+0.5)-                                                         C.lineTo (x+w) (y+h/2+0.5)-                                                         C.stroke-                               case p of-                                      Nothing -> return ()-                                      Just p' -> do-                                                 cairo $ do-                                                         g <- setPointStyle p'-                                                         C.moveTo (x+w/2) (y+h/2)-                                                         renderGlyph 1 g+  let l = decorationGetLineType d+  let p = decorationGetPointType d+  case l of+    Nothing -> return ()+    Just l' -> do+      cairo $ do+        setLineStyle l'+        C.moveTo x     (y+h/2+0.5)+        C.lineTo (x+w) (y+h/2+0.5)+        C.stroke+  case p of+    Nothing -> return ()+    Just p' -> do+      cairo $ do+        g <- setPointStyle p'+        C.moveTo (x+w/2) (y+h/2)+        renderGlyph 1 g  ----------------------------------------------------------------------------- 
lib/Graphics/Rendering/Plot/Types.hs view
@@ -419,6 +419,7 @@ -- | a plot  data PlotData = Plot {        _border      :: Border+    , _back_colr :: Color     , _plot_pads :: Padding     , _heading   :: TextEntry     , _ranges    :: Ranges@@ -474,7 +475,8 @@  -- | a chart has a title and contains one or more plots data FigureData = Figure { -      _fig_pads    :: Padding+      _back_clr  :: Color+    , _fig_pads  :: Padding     , _title     :: TextEntry     , _subtitle  :: TextEntry     , _plots     :: Plots
plot.cabal view
@@ -1,5 +1,5 @@ Name:                plot-Version:             0.2+Version:             0.2.1 License:             BSD3 License-file:        LICENSE Copyright:           (c) A.V.H. McPhail 2010, 2012