plot 0.1.2.4 → 0.1.3.0
raw patch · 9 files changed
+213/−178 lines, 9 files
Files
- CHANGES +12/−0
- lib/Graphics/Rendering/Plot/Figure.hs +2/−1
- lib/Graphics/Rendering/Plot/Figure/Plot.hs +1/−1
- lib/Graphics/Rendering/Plot/Render/Plot/Annotation.hs +20/−12
- lib/Graphics/Rendering/Plot/Render/Plot/Data.hs +147/−132
- lib/Graphics/Rendering/Plot/Render/Plot/Format.hs +22/−23
- lib/Graphics/Rendering/Plot/Render/Plot/Glyph.hs +7/−7
- lib/Graphics/Rendering/Plot/Render/Plot/Legend.hs +1/−1
- plot.cabal +1/−1
CHANGES view
@@ -35,3 +35,15 @@ 0.1.2.4: * bumped gtk dependency * changed 'State' constructor to 'state' function to reflect mtl > 2++0.1.2.5:+ * fixed bug in surface axis labels++0.1.2.6:+ * fixed treatment of 0 in log axes+ * fixed reversed range values+ * thus reverting 0.1.2.5 non-bug+ * export Data.Colour.Names++0.1.3.0:+ * change scaling so that miniscule linewidths don't occur
lib/Graphics/Rendering/Plot/Figure.hs view
@@ -24,8 +24,9 @@ ----------------------------------------------------------------------------- module Graphics.Rendering.Plot.Figure (+ module Data.Colour.Names -- * Top level operation- Figure(), FigureState()+ , Figure(), FigureState() -- * Default options , withTextDefaults , withLineDefaults
lib/Graphics/Rendering/Plot/Figure/Plot.hs view
@@ -292,7 +292,7 @@ xm = unzip $ map abscMinMax xm' xmm = (minimum $ fst xm,maximum $ snd xm) in (xmm,ymm)-calculateRanges (DS_Surf m) = ((0,fromIntegral $ rows m),(fromIntegral $ cols m,0))+calculateRanges (DS_Surf m) = ((0,fromIntegral $ cols m),(fromIntegral $ rows m,0)) -----------------------------------------------------------------------------
lib/Graphics/Rendering/Plot/Render/Plot/Annotation.hs view
@@ -63,8 +63,10 @@ ----------------------------------------------------------------------------- renderAnnotation :: Double -> Double -> Annotation -> Render ()-renderAnnotation xsc ysc (AnnArrow h lt (x1,y1) (x2,y2)) = do- formatLineSeries lt xsc ysc+renderAnnotation xscale yscale (AnnArrow h lt (x1',y1') (x2',y2')) = do+ formatLineSeries lt+ let (x1,y1) = (x1'/xscale,y1'/yscale)+ let (x2,y2) = (x2'/xscale,y2'/yscale) cairo $ do C.moveTo x1 y1 C.lineTo x2 y2@@ -86,8 +88,10 @@ C.fill ) C.stroke-renderAnnotation xsc ysc (AnnOval f b (x1,y1) (x2,y2)) = do- (_,bc,c) <- formatBarSeries b xsc ysc+renderAnnotation xscale yscale (AnnOval f b (x1',y1') (x2',y2')) = do+ (_,bc,c) <- formatBarSeries b+ let (x1,y1) = (x1'/xscale,y1'/yscale)+ let (x2,y2) = (x2'/xscale,y2'/yscale) let width = x2 - x1 height = y2 - y1 x = x1 + width/2@@ -104,8 +108,10 @@ setColour bc C.fill) C.newPath-renderAnnotation xsc ysc (AnnRect f b (x1,y1) (x2,y2)) = do- (_,bc,c) <- formatBarSeries b xsc ysc+renderAnnotation xscale yscale (AnnRect f b (x1',y1') (x2',y2')) = do+ (_,bc,c) <- formatBarSeries b+ let (x1,y1) = (x1'/xscale,y1'/yscale)+ let (x2,y2) = (x2'/xscale,y2'/yscale) cairo $ do C.save setColour c@@ -116,17 +122,19 @@ setColour bc C.fill) C.newPath-renderAnnotation xsc ysc (AnnGlyph pt (x1,y1)) = do- (pw,g) <- formatPointSeries pt xsc ysc+renderAnnotation xscale yscale (AnnGlyph pt (x1',y1')) = do+ (pw,g) <- formatPointSeries pt+ let (x1,y1) = (x1'/xscale,y1'/yscale) cairo $ do C.moveTo x1 y1- renderGlyph xsc ysc pw g-renderAnnotation xsc ysc (AnnText te (x1,y1)) = do+ renderGlyph pw g+renderAnnotation xscale yscale (AnnText te (x1',y1')) = do -- (x,y) <- cairo $ C.userToDevice x1 y1+ let (x1,y1) = (x1'/xscale,y1'/yscale) cairo $ do C.save- C.scale (recip xsc) (recip (-ysc))- _ <- renderText te TRight TTop (x1*xsc) (y1*ysc)+ --C.scale (recip xscale) (recip (-yscale))+ _ <- renderText te TRight TTop (x1*xscale) (y1*yscale) cairo $ C.restore return () renderAnnotation _ _ (AnnCairo r) = do
lib/Graphics/Rendering/Plot/Render/Plot/Data.hs view
@@ -60,13 +60,13 @@ findMinIdx, findMaxIdx :: Vector Double -> Double -> Int -> Int -> Int findMinIdx v x n max- | n >= max = error "data not in range"+ | n >= max = error "findMinIdx: data not in range" | v @> n >= x = n- | otherwise = findMinIdx v x (n+1) max+ | otherwise = findMinIdx v x (n+1) max findMaxIdx v x n min- | n < 0 = error "data not in range"- | v @> n <= x = n+ | n < 0 = error "findMaxIdx: data not in range"+ | v @> n <= x = n | otherwise = findMaxIdx v x (n-1) min -----------------------------------------------------------------------------@@ -87,6 +87,11 @@ ---------------------------------------------------------------------------- +zeroToOne :: Double -> Double+zeroToOne x+ | x == 0.0 = 1.0+ | otherwise = x+ renderData :: Ranges -> DataSeries -> Render () renderData _ (DS_Surf m) = do (BoundingBox x y w h) <- get@@ -126,16 +131,16 @@ let (los,ups) = partition (\(_,DecSeries o _) -> isLower o) aos (BoundingBox x y w h) <- get let (xsc,xmin',xmax') = getRanges XAxis Lower r- let (xmin,xmax) = if xsc == Log then (logBase 10 xmin',logBase 10 xmax') else (xmin',xmax')+ let (xmin,xmax) = if xsc == Log then (logBase 10 $ zeroToOne xmin',logBase 10 $ zeroToOne xmax') else (xmin',xmax') let xscale = w/(xmax-xmin) cairo $ C.save let (yscl,yminl',ymaxl') = getRanges YAxis Lower r- let (yminl,ymaxl) = if yscl == Log then (logBase 10 yminl',logBase 10 ymaxl') else (yminl',ymaxl')+ let (yminl,ymaxl) = if yscl == Log then (logBase 10 $ zeroToOne yminl',logBase 10 $ zeroToOne ymaxl') else (yminl',ymaxl') let yscalel = h/(ymaxl-yminl) -- transform to data coordinates cairo $ do C.translate x (y+h)- C.scale xscale yscalel+ --C.scale xscale yscalel C.translate (-xmin) yminl flipVertical mapM_ (renderSeries xsc yscl xmin xmax xscale yscalel) los@@ -144,12 +149,12 @@ (do cairo $ C.save let (yscu,yminu',ymaxu') = getRanges YAxis Upper r- let (yminu,ymaxu) = if yscu == Log then (logBase 10 yminu',logBase 10 ymaxu') else (yminu',ymaxu')+ let (yminu,ymaxu) = if yscu == Log then (logBase 10 $ zeroToOne yminu',logBase 10 $ zeroToOne ymaxu') else (yminu',ymaxu') let yscaleu = h/(ymaxu-yminu) -- transform to data coordinates cairo $ do C.translate x (y+h)- C.scale xscale yscaleu+ --C.scale xscale yscaleu C.translate xmin yminu flipVertical mapM_ (renderSeries xsc yscu xmin xmax xscale yscaleu) ups@@ -193,80 +198,81 @@ in Right (((m1,a'),(bl',bu')),((m2,c'),(dl',du')))) dat''' case d of (DecLine lt) -> do- formatLineSeries lt xscale yscale- mapM_ (\(t',y') -> renderSamples xmin xmax Nothing + formatLineSeries lt+ mapM_ (\(t',y') -> renderSamples xscale yscale xmin xmax Nothing renderLineSample endLineSample t' y') (map (either id (error "MinMax data")) dat) (DecPoint pt) -> do- (pz,g) <- formatPointSeries pt xscale yscale+ (pz,g) <- formatPointSeries pt let gs = g : Bot : Top : []- mapM_ (\(g',(t',y')) -> renderSamples xmin xmax Nothing - (renderPointSample xscale yscale pz g') endPointSample t' y') + mapM_ (\(g',(t',y')) -> renderSamples xscale yscale xmin xmax Nothing + (renderPointSample pz g') endPointSample t' y') (zip gs (map (either id (error "MinMax data")) dat)) (DecLinPt lt pt) -> do- formatLineSeries lt xscale yscale- mapM_ (\(t',y') -> renderSamples xmin xmax Nothing + formatLineSeries lt+ mapM_ (\(t',y') -> renderSamples xscale yscale xmin xmax Nothing renderLineSample endLineSample t' y') (map (either id (error "MinMax data")) dat)- (pz,g) <- formatPointSeries pt xscale yscale+ (pz,g) <- formatPointSeries pt let gs = g : Bot : Top : []- mapM_ (\(g',(t',y')) -> renderSamples xmin xmax Nothing - (renderPointSample xscale yscale pz g') endPointSample t' y')+ mapM_ (\(g',(t',y')) -> renderSamples xscale yscale xmin xmax Nothing + (renderPointSample pz g') endPointSample t' y') (zip gs (map (either id (error "MinMax data")) dat)) (DecImpulse lt) -> do- formatLineSeries lt xscale yscale- mapM_ (\(t',y') -> renderSamples xmin xmax Nothing + formatLineSeries lt+ mapM_ (\(t',y') -> renderSamples xscale yscale xmin xmax Nothing renderImpulseSample endImpulseSample t' y') (map (either id (error "MinMax data")) dat) (DecStep lt) -> do- formatLineSeries lt xscale yscale- mapM_ (\(t',y') -> renderSamples xmin xmax Nothing + formatLineSeries lt+ mapM_ (\(t',y') -> renderSamples xscale yscale xmin xmax Nothing renderStepSample endStepSample t' y') (map (either id (error "MinMax data")) dat) (DecArea lt) -> do- formatLineSeries lt xscale yscale+ formatLineSeries lt let Left hd = head dat ln = dim $ snd $ fst hd xmin_ix = findMinIdx (snd $ fst hd) xmin 0 (ln-1) x0 = (snd $ fst hd) @> xmin_ix y0 = (snd hd) @> xmin_ix- mapM_ (\(t',y') -> renderSamples xmin xmax Nothing + mapM_ (\(t',y') -> renderSamples xscale yscale xmin xmax Nothing renderAreaSample (endAreaSample x0 y0) t' y') (map (either id (error "MinMax data")) dat) (DecBar bt) -> do- (bw,bc,c) <- formatBarSeries bt xscale yscale- mapM_ (\(t',y') -> renderSamples xmin xmax Nothing + (bw,bc,c) <- formatBarSeries bt+ mapM_ (\(t',y') -> renderSamples xscale yscale xmin xmax Nothing (renderBarSample bw bc c) endBarSample t' y') (map (either id (error "MinMax data")) dat) (DecHist bt) -> do- (bw,bc,c) <- formatBarSeries bt xscale yscale+ (bw,bc,c) <- formatBarSeries bt let Left hd = head dat ln = dim $ snd $ fst hd xmin_ix = findMinIdx (snd $ fst hd) xmin 0 (ln-1) rest (m,v) = (m,subVector 1 (dim v - 1) v) x0 = (snd $ fst hd) @> xmin_ix y0 = 0- mapM_ (\(t',y') -> renderSamples xmin xmax (Just $ C.moveTo x0 y0) + mapM_ (\(t',y') -> renderSamples xscale yscale xmin xmax (Just $ C.moveTo x0 y0) (renderHistSample bw bc c) endHistSample (rest t') y') (map (either id (error "MinMax data")) dat) (DecCand bt) → do- (bw,bc,c) ← formatBarSeries bt xscale yscale+ (bw,bc,c) ← formatBarSeries bt mapM_ (\((t',y'),(_,e')) → do- renderMinMaxSamples xmin xmax Nothing+ renderMinMaxSamples xscale yscale xmin xmax Nothing (renderWhiskerSample bw bc c False) endWhiskerSample t' e'- renderMinMaxSamples xmin xmax Nothing- (renderCandleSample bw bc c) endCandleSample t' y'+ renderMinMaxSamples xscale yscale xmin xmax Nothing+ (renderCandleSample bw bc c) endCandleSample t' y' ) (map (either (error "Single data") id) dat) (DecWhisk bt) → do- (bw,bc,c) ← formatBarSeries bt xscale yscale+ (bw,bc,c) ← formatBarSeries bt mapM_ (\((t',y'),(_,e')) → do- renderMinMaxSamples xmin xmax Nothing+ renderMinMaxSamples xscale yscale xmin xmax Nothing (renderWhiskerSample bw bc c True) endWhiskerSample t' e'- renderMinMaxSamples xmin xmax Nothing- (renderCandleSample bw bc c) endCandleSample t' y'+ renderMinMaxSamples xscale yscale xmin xmax Nothing+ (renderCandleSample bw bc c) endCandleSample t' y' ) (map (either (error "Single data") id) dat) return () ----------------------------------------------------------------------------- renderSamples :: Double -> Double + -> Double -> Double -> Maybe (C.Render ())- -> (Double -> Double -> C.Render ()) -> C.Render ()+ -> (Double -> Double -> Double -> Double -> C.Render ()) -> (Double -> Double -> C.Render ()) -> (Bool,Vector Double) -> Vector Double -> Render ()-renderSamples xmin xmax s f e (mono,t) y = do+renderSamples xscale yscale xmin xmax s f e (mono,t) y = do (BoundingBox _ _ w _) <- get let ln = dim t (xmin_ix,xmax_ix,num_pts) = if mono@@ -279,22 +285,23 @@ diff = if mono then diff' else 1 cairo $ do case s of- Nothing -> C.moveTo (t @> xmin_ix) (y @> xmin_ix)+ Nothing -> C.moveTo ((t @> xmin_ix)/xscale) ((y @> xmin_ix)/yscale) Just s' -> s' _ <- runMaybeT $ do mapVectorWithIndexM_ (\i y' -> do when (i >= xmin_ix && i `mod` diff == 0)- (renderSample i xmax_ix t f y')+ (renderSample i xmax_ix t (f xscale yscale) y') return ()) y- e+ (e xscale yscale) ----------------------------------------------------------------------------- renderMinMaxSamples :: Double -> Double + -> Double -> Double -> Maybe (C.Render ())- -> (Double -> (Double,Double) -> C.Render ()) -> C.Render ()+ -> (Double -> Double -> Double -> (Double,Double) -> C.Render ()) -> (Double -> Double -> C.Render ()) -> (Bool,Vector Double) -> (Vector Double,Vector Double) -> Render ()-renderMinMaxSamples xmin xmax s f e (mono,t) y = do+renderMinMaxSamples xscale yscale xmin xmax s f e (mono,t) y = do (BoundingBox _ _ w _) <- get let ln = dim t (xmin_ix,xmax_ix,num_pts) = if mono@@ -307,11 +314,11 @@ diff = if mono then diff' else 1 cairo $ do case s of- Nothing -> C.moveTo (t @> xmin_ix) ((fst $ y) @> xmin_ix)+ Nothing -> C.moveTo ((t @> xmin_ix)/xscale) (((fst $ y) @> xmin_ix)/yscale) Just s' -> s' _ <- runMaybeT $ mapVectorWithIndexM_ (\i t' -> do when (i >= xmin_ix && i `mod` diff == 0)- (renderMinMaxSample i xmax_ix t' f e y)+ (renderMinMaxSample i xmax_ix t' (f xscale yscale) (e xscale yscale) y) return ()) t return () @@ -341,109 +348,117 @@ ----------------------------------------------------------------------------- -renderLineSample :: Double -> Double -> C.Render ()-renderLineSample = C.lineTo+renderLineSample :: Double → Double -> Double -> Double -> C.Render ()+renderLineSample xscale yscale x y = C.lineTo (x/xscale) (y/yscale) -endLineSample :: C.Render ()-endLineSample = C.stroke+endLineSample :: Double -> Double -> C.Render ()+endLineSample _ _ = C.stroke -renderPointSample :: Double -> Double -> LineWidth -> Glyph -> Double -> Double -> C.Render ()-renderPointSample xscale yscale pz g x y = do- C.moveTo x y- renderGlyph xscale yscale pz g+renderPointSample :: LineWidth -> Glyph -> Double -> Double -> Double -> Double -> C.Render ()+renderPointSample pz g xscale yscale x y = do+ C.moveTo (x/xscale) (y/yscale)+ renderGlyph pz g -endPointSample :: C.Render ()-endPointSample = return ()+endPointSample :: Double -> Double -> C.Render ()+endPointSample _ _ = return () -renderImpulseSample :: Double -> Double -> C.Render ()-renderImpulseSample x y = do- C.moveTo x 0- C.lineTo x y- C.stroke+renderImpulseSample :: Double -> Double -> Double -> Double -> C.Render ()+renderImpulseSample xscale yscale x y = do+ let x' = x/xscale+ C.moveTo x' 0+ C.lineTo x (y/yscale)+ C.stroke -endImpulseSample :: C.Render ()-endImpulseSample = return ()+endImpulseSample :: Double -> Double -> C.Render ()+endImpulseSample _ _ = return () -renderStepSample :: Double -> Double -> C.Render ()-renderStepSample x y = do- (x',_) <- C.getCurrentPoint- C.lineTo x' y- C.lineTo x y+renderStepSample :: Double -> Double -> Double -> Double -> C.Render ()+renderStepSample xscale yscale x y = do+ (x',_) <- C.getCurrentPoint+ let y' = y/yscale+ C.lineTo x' y'+ C.lineTo (x/xscale) y' -endStepSample :: C.Render ()-endStepSample = C.stroke+endStepSample :: Double -> Double -> C.Render ()+endStepSample _ _ = C.stroke -renderAreaSample :: Double -> Double -> C.Render ()-renderAreaSample = C.lineTo+renderAreaSample :: Double -> Double -> Double -> Double -> C.Render ()+renderAreaSample xscale yscale x y = C.lineTo (x/xscale) (y/yscale) -endAreaSample :: Double -> Double -> C.Render ()-endAreaSample x0 _ = do- (x',_) <- C.getCurrentPoint- C.lineTo x' 0- C.lineTo x0 0- -- C.lineTo x0 y0- C.closePath- C.fill- C.stroke+endAreaSample :: Double -> Double -> Double -> Double -> C.Render ()+endAreaSample x0 _ xscale _ = do+ (x',_) <- C.getCurrentPoint+ let x0' = x0/xscale+ C.lineTo x' 0+ C.lineTo x0' 0+ -- C.lineTo x0 y0+ C.closePath+ C.fill+ C.stroke -renderBarSample :: Width -> Color -> Color -> Double -> Double -> C.Render ()-renderBarSample bw c bc x y = do- setColour bc- C.rectangle (x-bw/2) 0 bw y- C.strokePreserve- setColour c- C.fill+renderBarSample :: Width -> Color -> Color -> Double -> Double -> Double -> Double -> C.Render ()+renderBarSample bw c bc xscale yscale x y = do+ setColour bc+ let bw' = bw/xscale+ C.rectangle ((x/xscale)-bw'/2) 0 bw' (y/yscale)+ C.strokePreserve+ setColour c+ C.fill --endBarSample :: C.Render ()-endBarSample = return ()+endBarSample :: Double -> Double -> C.Render ()+endBarSample _ _ = return () -renderHistSample :: Width -> Color -> Color -> Double -> Double -> C.Render ()-renderHistSample _ c bc x y = do- (x',_) <- C.getCurrentPoint- C.stroke- setColour bc- C.rectangle x' 0 (x-x') y- C.strokePreserve- setColour c- C.fill- C.moveTo x 0+renderHistSample :: Width -> Color -> Color -> Double -> Double -> Double -> Double -> C.Render ()+renderHistSample _ c bc xscale yscale x y = do+ (x',_) <- C.getCurrentPoint+ let x'' = x/xscale+ C.stroke+ setColour bc+ C.rectangle x' 0 (x''-x') (y/yscale)+ C.strokePreserve+ setColour c+ C.fill+ C.moveTo x'' 0 -endHistSample :: C.Render ()-endHistSample = return ()+endHistSample :: Double -> Double -> C.Render ()+endHistSample _ _ = return () -renderCandleSample :: Width -> Color -> Color -> Double -> (Double,Double) -> C.Render ()-renderCandleSample bw c bc x (yl,yu) = do- setColour bc- C.rectangle (x-bw/2) yl bw (yu-yl)- C.strokePreserve- liftIO $ putStrLn $ (show yl) ++ " " ++ (show yu)- if (yl < yu)- then do- setColour c- else do- C.setSourceRGBA 1 1 1 1- C.fill+renderCandleSample :: Width -> Color -> Color -> Double -> Double -> Double -> (Double,Double) -> C.Render ()+renderCandleSample bw c bc xscale yscale x (yl,yu) = do+ setColour bc+ let (yl',yu') = (yl/yscale,yu/yscale)+ bw' = bw/xscale+ C.rectangle ((x/xscale)-bw'/2) yl' bw' (yu'-yl')+ C.strokePreserve+ --liftIO $ putStrLn $ (show yl') ++ " " ++ (show yu')+ if (yl < yu)+ then do+ setColour c+ else do+ C.setSourceRGBA 1 1 1 1+ C.fill -endCandleSample :: C.Render ()-endCandleSample = return ()+endCandleSample :: Double -> Double -> C.Render ()+endCandleSample _ _ = return () -renderWhiskerSample :: Width -> Color -> Color → Bool -> Double -> (Double,Double) -> C.Render ()-renderWhiskerSample bw _ bc whiskers x (yl,yu) = do- setColour bc- C.moveTo x yl- C.lineTo x yu- if whiskers- then do- C.moveTo (x-bw/2) yu- C.lineTo (x+bw/2) yu- C.moveTo (x-bw/2) yl- C.lineTo (x+bw/2) yl- else return ()- C.stroke+renderWhiskerSample :: Width -> Color -> Color → Bool -> Double -> Double -> Double -> (Double,Double) -> C.Render ()+renderWhiskerSample bw _ bc whiskers x xscale yscale (yl,yu) = do+ setColour bc+ let (x',yl',yu') = (x/xscale,yl/yscale,yu/yscale)+ bw' = bw/xscale+ C.moveTo x' yl'+ C.lineTo x' yu'+ if whiskers+ then do+ C.moveTo (x'-bw'/2) yu'+ C.lineTo (x'+bw'/2) yu'+ C.moveTo (x'-bw'/2) yl'+ C.lineTo (x'+bw'/2) yl'+ else return ()+ C.stroke -endWhiskerSample :: C.Render ()-endWhiskerSample = return ()+endWhiskerSample :: Double -> Double -> C.Render ()+endWhiskerSample _ _ = return () -----------------------------------------------------------------------------
lib/Graphics/Rendering/Plot/Render/Plot/Format.hs view
@@ -33,38 +33,37 @@ formatLineSeries' :: [Dash] -> LineWidth -> Color -> C.Render () formatLineSeries' ds lw c = do- setDashes ds- C.setLineWidth lw - setColour c+ setDashes ds+ C.setLineWidth lw + setColour c -formatLineSeries :: LineType -> Double -> Double -> Render ()-formatLineSeries NoLine _ _ = error "line format of NoLine in a line series"-formatLineSeries (ColourLine c) xscale yscale = do- (LineOptions ds lw) <- asks (_lineoptions . _renderoptions)- cairo $ formatLineSeries' ds ((lw)/(xscale+yscale)) c-formatLineSeries (TypeLine (LineOptions ds lw) c) xscale yscale = cairo $ formatLineSeries' ds ((lw)/(xscale+yscale)) c+formatLineSeries :: LineType -> Render ()+formatLineSeries NoLine = error "line format of NoLine in a line series"+formatLineSeries (ColourLine c) = do+ (LineOptions ds lw) <- asks (_lineoptions . _renderoptions)+ cairo $ formatLineSeries' ds lw c+formatLineSeries (TypeLine (LineOptions ds lw) c) =+ cairo $ formatLineSeries' ds lw c formatPointSeries' :: Color -> C.Render () formatPointSeries' = setColour -formatPointSeries :: PointType -> Double -> Double -> Render (LineWidth,Glyph)-formatPointSeries (FullPoint (PointOptions pz c) g) _ _ = do- cairo $ formatPointSeries' c- return (pz,g)+formatPointSeries :: PointType -> Render (LineWidth,Glyph)+formatPointSeries (FullPoint (PointOptions pz c) g) = do+ cairo $ formatPointSeries' c+ return (pz,g) formatBarSeries' :: LineWidth -> C.Render () formatBarSeries' lw = C.setLineWidth lw -formatBarSeries :: BarType -> Double -> Double -> Render (Width,Color,Color)-formatBarSeries (ColourBar c) xscale yscale = do- let sc = (xscale+yscale)/2- (BarOptions bw lw bc) <- asks (_baroptions . _renderoptions)- cairo $ formatBarSeries' (lw/sc)- return (bw/sc,c,bc)-formatBarSeries (TypeBar (BarOptions bw lw bc) c) xscale yscale = do- let sc = (xscale+yscale)/2- cairo $ formatBarSeries' (lw/sc)- return (bw/sc,c,bc)+formatBarSeries :: BarType -> Render (Width,Color,Color)+formatBarSeries (ColourBar c) = do+ (BarOptions bw lw bc) <- asks (_baroptions . _renderoptions)+ cairo $ formatBarSeries' lw+ return (bw,c,bc)+formatBarSeries (TypeBar (BarOptions bw lw bc) c) = do+ cairo $ formatBarSeries' lw+ return (bw,c,bc) -----------------------------------------------------------------------------
lib/Graphics/Rendering/Plot/Render/Plot/Glyph.hs view
@@ -28,13 +28,13 @@ glyphWidth :: Double glyphWidth = 2*pi -renderGlyph :: Double -> Double -> LineWidth -> Glyph -> C.Render ()-renderGlyph xscale yscale pz g = do- C.save- C.scale (pz / xscale) (pz / yscale)- C.setLineWidth pz- renderGlyph' g- C.restore+renderGlyph :: LineWidth -> Glyph -> C.Render ()+renderGlyph pz g = do+ C.save+ C.scale pz pz+ C.setLineWidth pz+ renderGlyph' g+ C.restore where renderGlyph' Box = renderGlyphBox renderGlyph' Cross = renderGlyphCross renderGlyph' Diamond = renderGlyphDiamond
lib/Graphics/Rendering/Plot/Render/Plot/Legend.hs view
@@ -285,7 +285,7 @@ cairo $ do g <- setPointStyle p' C.moveTo (x+w/2) (y+h/2)- renderGlyph 1 1 1 g+ renderGlyph 1 g -----------------------------------------------------------------------------
plot.cabal view
@@ -1,5 +1,5 @@ Name: plot-Version: 0.1.2.4+Version: 0.1.3.0 License: BSD3 License-file: LICENSE Copyright: (c) A.V.H. McPhail 2010