New patches: [unrevert anonymous**20101006083640] { hunk ./lib/Graphics/Rendering/Plot/Defaults.hs 73 defaultLineType :: LineType defaultLineType = ColourLine black +defaultGridLine :: LineType +defaultGridLine = ColourLine grey + ----------------------------------------------------------------------------- defaultBarWidth :: Double hunk ./lib/Graphics/Rendering/Plot/Defaults.hs 163 tickLabelScale = 0.75 defaultMinorTicks :: Ticks -defaultMinorTicks = Ticks False (Left 41) +defaultMinorTicks = Ticks NoLine (Left 41) defaultMajorTicks :: Ticks hunk ./lib/Graphics/Rendering/Plot/Defaults.hs 166 -defaultMajorTicks = Ticks False (Left 5) +defaultMajorTicks = Ticks NoLine (Left 5) defaultTickFormat :: TickFormat defaultTickFormat = "" hunk ./lib/Graphics/Rendering/Plot/Figure/Plot.hs 74 , AX.setTickLabelFormat , AX.withAxisLabel , AX.withAxisLine + , AX.withGridLine ) where ----------------------------------------------------------------------------- hunk ./lib/Graphics/Rendering/Plot/Figure/Plot/Axis.hs 16 ----------------------------------------------------------------------------- module Graphics.Rendering.Plot.Figure.Plot.Axis ( - Axis - , AxisType(..),AxisSide(..),AxisPosn(..) - , Tick(..), TickValues, GridLines - , setTicks - , setGridlines - , setTickLabelFormat - , withAxisLabel - , withAxisLine - ) where + Axis + , AxisType(..),AxisSide(..),AxisPosn(..) + , Tick(..), TickValues, GridLines + , setTicks + , setGridlines + , setTickLabelFormat + , withAxisLabel + , withAxisLine + , withGridLine + ) where ----------------------------------------------------------------------------- hunk ./lib/Graphics/Rendering/Plot/Figure/Plot/Axis.hs 33 import Control.Monad.Reader import Graphics.Rendering.Plot.Types +import Graphics.Rendering.Plot.Defaults ----------------------------------------------------------------------------- hunk ./lib/Graphics/Rendering/Plot/Figure/Plot/Axis.hs 62 let lt = execLine m lo l modify $ \s -> s { _line_type = lt } +-- | format the grid lines +withGridLine :: Tick -> Line () -> Axis () +withGridLine t m = do + lo <- asks _lineoptions + (lt',v) <- case t of + Minor -> do + (Ticks lt'' v') <- gets _minor_ticks + return (lt'',v') + Major -> do + (Ticks lt'' v') <- gets _major_ticks + return (lt'',v') + let lt = execLine m lo lt' + case t of + Minor -> modify $ \s -> s { _minor_ticks = Ticks lt v } + Major -> modify $ \s -> s { _major_ticks = Ticks lt v } + -- | format the axis ticks setTicks :: Tick -> TickValues -> Axis () setTicks Minor ts = modify $ \s -> changeMinorTicks (setTickValues ts) s hunk ./lib/Graphics/Rendering/Plot/Figure/Plot/Axis.hs 85 -- | should gridlines be displayed? setGridlines :: Tick -> GridLines -> Axis () -setGridlines Minor gl = modify $ \s -> changeMinorTicks (setTickGridlines gl) s -setGridlines Major gl = modify $ \s -> changeMajorTicks (setTickGridlines gl) s +setGridlines Minor gl = modify $ \s -> changeMinorTicks (setTickGridlines (if gl then defaultGridLine else NoLine)) s +setGridlines Major gl = modify $ \s -> changeMajorTicks (setTickGridlines (if gl then defaultGridLine else NoLine)) s -- | printf format that takes one argument, the tick value setTickLabelFormat :: String -> Axis () hunk ./lib/Graphics/Rendering/Plot/Render/Plot/Axis.hs 384 renderAxisTick :: P.PangoContext -> TextOptions -> Double -> Double -> Double -> Double -> Scale -> Double -> Double - -> AxisType -> AxisPosn -> TickFormat -> Tick -> GridLines + -> AxisType -> AxisPosn -> TickFormat -> Tick -> LineType -> (Double,Double,Double) -> C.Render () renderAxisTick pc to x y w h sc min max xa sd tf t gl (p,l,v) = do let tl' = case t of hunk ./lib/Graphics/Rendering/Plot/Render/Plot/Axis.hs 409 moveTo x1 y1 lineTo x2 y2 C.stroke - when gl (do + when (gl /= NoLine) (do let (x3,y3,x4,y4) = case xa of XAxis -> case sd of (Side Lower) -> let xt x' = x + (x'-min)*w/(max-min) hunk ./lib/Graphics/Rendering/Plot/Render/Plot/Axis.hs 426 (Value _) -> let yt y' = (y + h) - (y'-min)*h/(max-min) in (x,yt p,x+w,yt p) C.save - lw <- C.getLineWidth - C.setLineWidth (lw/2) - C.setDash [4,4] 0 - C.setSourceRGBA 0 0 0 0.5 + setLineStyle gl moveTo x3 y3 lineTo x4 y4 C.stroke hunk ./lib/Graphics/Rendering/Plot/Types.hs 91 ----------------------------------------------------------------------------- -data Dash = Dot | Dash +data Dash = Dot | Dash deriving(Eq) type DashStyle = [Dash] type LineWidth = Double -- not using line join hunk ./lib/Graphics/Rendering/Plot/Types.hs 98 -- not using line cap -- do we want arrows? data LineOptions = LineOptions DashStyle LineWidth + deriving(Eq) data LineType = NoLine | ColourLine Color hunk ./lib/Graphics/Rendering/Plot/Types.hs 103 | TypeLine LineOptions Color + deriving(Eq) ----------------------------------------------------------------------------- hunk ./lib/Graphics/Rendering/Plot/Types.hs 186 type GridLines = Bool type TickValues = Either Int (Vector Double) -- ^ Either (number of ticks) (tick values) -data Ticks = Ticks GridLines TickValues +data Ticks = Ticks LineType TickValues hunk ./lib/Graphics/Rendering/Plot/Types.hs 188 -setTickGridlines :: GridLines -> Ticks -> Ticks +setTickGridlines :: LineType -> Ticks -> Ticks setTickGridlines gl (Ticks _ tv) = Ticks gl tv setTickValues :: TickValues -> Ticks -> Ticks hunk ./lib/Test.hs 122 cairo (\_ _ _ _ -> do C.moveTo 3 0.75 C.lineTo 4 (-0.5) + C.stroke ) -- setRange YAxis Lower Log (-1.25) 1.25 -- setLegend True NorthEast Inside } Context: [improve dashes and doc fixes Vivian McPhail **20101006074729] [setDataset documentation Vivian McPhail **20101006072819] [fix cairo annotation (save/restore) Vivian McPhail **20101006070659] [warnings Vivian McPhail **20101005101556] [check for monotonicity upon creation Vivian McPhail **20101005095627] [add annotations Vivian McPhail **20101005095025] [improve axis line joins Vivian McPhail **20101003112819] [remove unicode symbols Vivian McPhail **20101003044120] [version 0.1.1.3 Vivian McPhail **20101002054519] [fix lack of stroke when sampling (reported by A Ruiz) Vivian McPhail **20101002054226] [hollow glyphs now fill with opaque white Vivian McPhail **20101002044044] [fix examples for Scale Vivian McPhail **20101002012747] [export MinMaxSeries Vivian McPhail **20101001053405] [TAG 0.1.1 Vivian McPhail **20101001050601] Patch bundle hash: d95f1b60e9005ce8df84f61bc77510d82da7faad