plot 0.2.3 → 0.2.3.1
raw patch · 4 files changed
+23/−12 lines, 4 files
Files
- CHANGES +3/−0
- examples/Test.hs +5/−2
- lib/Graphics/Rendering/Plot/Render/Plot/Annotation.hs +13/−9
- plot.cabal +2/−1
CHANGES view
@@ -115,3 +115,6 @@ 0.2.3: * add sampleData action to a plot++0.2.3.1:+ * fix bugs (-y) in rendering annotations. Issue #7
examples/Test.hs view
@@ -112,14 +112,17 @@ setRangeFromData YAxis Lower Linear withAnnotations $ do arrow True (pi/2,0.5) (0,0) (return ())- --oval True (0.5,1) (1,3) $ setBarColour blue- rect True (0.5,0.5) (2,0.75) $ (return ())+ oval True (1.5,0) (pi,0.5) $ setBarColour blue+ rect True (0.5,0.5) (2,0.6) $ (return ()) glyph (4,0.2) (return ()) text (3,0.0) (setText "from the α to the Ω") cairo (\_ _ _ _ -> do+ C.newPath C.moveTo 3 0.75 C.lineTo 4 (-0.5) C.stroke+ C.rectangle (pi/2) (-1) (pi/2) 1+ C.fill ) -- setRange YAxis Lower Log (-1.25) 1.25 -- setLegend True NorthEast Inside
lib/Graphics/Rendering/Plot/Render/Plot/Annotation.hs view
@@ -99,8 +99,8 @@ cairo $ do C.save setColour c- C.translate (x + width / 2) (y + height / 2)- C.scale (1 / (height / 2)) (1 / (width / 2))+ C.translate x y+ C.scale (yscale/2) (xscale/2) C.arc 0 0 1 0 (2 * pi) C.restore C.strokePreserve@@ -110,12 +110,13 @@ C.newPath 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)+ let (x1,y1) = (x1'*xscale,-y1'*yscale)+ let (x2,y2) = (x2'*xscale,-y2'*yscale) cairo $ do C.save setColour c- C.rectangle x1 y1 x2 y2+ flipVertical+ C.rectangle x1 y1 (x2-x1) (y2-y1) C.restore C.strokePreserve when f (do@@ -130,19 +131,22 @@ 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)+ let (x1,y1) = (x1'*xscale,-y1'*yscale) cairo $ do C.save- --C.scale (recip xscale) (recip (-yscale)) flipVertical--- _ <- renderText te TRight TTop (x1') (y1') _ <- renderText te TRight TTop (x1) (y1) cairo $ C.restore return ()-renderAnnotation _ _ (AnnCairo r) = do+renderAnnotation xscale yscale (AnnCairo r) = do (BoundingBox x y w h) <- get cairo $ do C.save+ --let (x,y) = (x'*xscale,y'*yscale)+ --let (w,h) = (w'*xscale,h'*yscale)+ --flipVertical+ --C.translate x y+ --C.scale (xscale) (yscale) r x y w h C.restore
plot.cabal view
@@ -1,5 +1,5 @@ Name: plot-Version: 0.2.3+Version: 0.2.3.1 License: BSD3 License-file: LICENSE Copyright: (c) A.V.H. McPhail 2010, 2012, 2013, 2014@@ -91,6 +91,7 @@ Control.Monad.Supply ghc-options: -Wall -fno-warn-unused-binds+ -O2 ghc-prof-options: -auto