gnuplot 0.4.1.1 → 0.4.2
raw patch · 6 files changed
+364/−9 lines, 6 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Graphics.Gnuplot.ColorSpecification: aquamarine :: T
+ Graphics.Gnuplot.ColorSpecification: beige :: T
+ Graphics.Gnuplot.ColorSpecification: black :: T
+ Graphics.Gnuplot.ColorSpecification: blue :: T
+ Graphics.Gnuplot.ColorSpecification: brown :: T
+ Graphics.Gnuplot.ColorSpecification: coral :: T
+ Graphics.Gnuplot.ColorSpecification: cyan :: T
+ Graphics.Gnuplot.ColorSpecification: darkBlue :: T
+ Graphics.Gnuplot.ColorSpecification: darkCyan :: T
+ Graphics.Gnuplot.ColorSpecification: darkGoldenrod :: T
+ Graphics.Gnuplot.ColorSpecification: darkGray :: T
+ Graphics.Gnuplot.ColorSpecification: darkGreen :: T
+ Graphics.Gnuplot.ColorSpecification: darkGrey :: T
+ Graphics.Gnuplot.ColorSpecification: darkKhaki :: T
+ Graphics.Gnuplot.ColorSpecification: darkMagenta :: T
+ Graphics.Gnuplot.ColorSpecification: darkOrange :: T
+ Graphics.Gnuplot.ColorSpecification: darkPink :: T
+ Graphics.Gnuplot.ColorSpecification: darkRed :: T
+ Graphics.Gnuplot.ColorSpecification: darkSalmon :: T
+ Graphics.Gnuplot.ColorSpecification: darkTurquoise :: T
+ Graphics.Gnuplot.ColorSpecification: darkViolet :: T
+ Graphics.Gnuplot.ColorSpecification: darkYellow :: T
+ Graphics.Gnuplot.ColorSpecification: data T
+ Graphics.Gnuplot.ColorSpecification: forestGreen :: T
+ Graphics.Gnuplot.ColorSpecification: gold :: T
+ Graphics.Gnuplot.ColorSpecification: goldenrod :: T
+ Graphics.Gnuplot.ColorSpecification: gray :: T
+ Graphics.Gnuplot.ColorSpecification: gray0 :: T
+ Graphics.Gnuplot.ColorSpecification: gray10 :: T
+ Graphics.Gnuplot.ColorSpecification: gray100 :: T
+ Graphics.Gnuplot.ColorSpecification: gray20 :: T
+ Graphics.Gnuplot.ColorSpecification: gray30 :: T
+ Graphics.Gnuplot.ColorSpecification: gray40 :: T
+ Graphics.Gnuplot.ColorSpecification: gray50 :: T
+ Graphics.Gnuplot.ColorSpecification: gray60 :: T
+ Graphics.Gnuplot.ColorSpecification: gray70 :: T
+ Graphics.Gnuplot.ColorSpecification: gray80 :: T
+ Graphics.Gnuplot.ColorSpecification: gray90 :: T
+ Graphics.Gnuplot.ColorSpecification: green :: T
+ Graphics.Gnuplot.ColorSpecification: grey :: T
+ Graphics.Gnuplot.ColorSpecification: grey0 :: T
+ Graphics.Gnuplot.ColorSpecification: grey10 :: T
+ Graphics.Gnuplot.ColorSpecification: grey100 :: T
+ Graphics.Gnuplot.ColorSpecification: grey20 :: T
+ Graphics.Gnuplot.ColorSpecification: grey30 :: T
+ Graphics.Gnuplot.ColorSpecification: grey40 :: T
+ Graphics.Gnuplot.ColorSpecification: grey50 :: T
+ Graphics.Gnuplot.ColorSpecification: grey60 :: T
+ Graphics.Gnuplot.ColorSpecification: grey70 :: T
+ Graphics.Gnuplot.ColorSpecification: grey80 :: T
+ Graphics.Gnuplot.ColorSpecification: grey90 :: T
+ Graphics.Gnuplot.ColorSpecification: khaki :: T
+ Graphics.Gnuplot.ColorSpecification: lightBlue :: T
+ Graphics.Gnuplot.ColorSpecification: lightCoral :: T
+ Graphics.Gnuplot.ColorSpecification: lightCyan :: T
+ Graphics.Gnuplot.ColorSpecification: lightGoldenrod :: T
+ Graphics.Gnuplot.ColorSpecification: lightGray :: T
+ Graphics.Gnuplot.ColorSpecification: lightGreen :: T
+ Graphics.Gnuplot.ColorSpecification: lightGrey :: T
+ Graphics.Gnuplot.ColorSpecification: lightMagenta :: T
+ Graphics.Gnuplot.ColorSpecification: lightPink :: T
+ Graphics.Gnuplot.ColorSpecification: lightRed :: T
+ Graphics.Gnuplot.ColorSpecification: lightSalmon :: T
+ Graphics.Gnuplot.ColorSpecification: lightTurquoise :: T
+ Graphics.Gnuplot.ColorSpecification: lightYellow :: T
+ Graphics.Gnuplot.ColorSpecification: magenta :: T
+ Graphics.Gnuplot.ColorSpecification: mediumBlue :: T
+ Graphics.Gnuplot.ColorSpecification: midnightBlue :: T
+ Graphics.Gnuplot.ColorSpecification: name :: String -> T
+ Graphics.Gnuplot.ColorSpecification: navy :: T
+ Graphics.Gnuplot.ColorSpecification: orange :: T
+ Graphics.Gnuplot.ColorSpecification: orangeRed :: T
+ Graphics.Gnuplot.ColorSpecification: paletteFrac :: Double -> T
+ Graphics.Gnuplot.ColorSpecification: pink :: T
+ Graphics.Gnuplot.ColorSpecification: plum :: T
+ Graphics.Gnuplot.ColorSpecification: purple :: T
+ Graphics.Gnuplot.ColorSpecification: red :: T
+ Graphics.Gnuplot.ColorSpecification: rgb :: Double -> Double -> Double -> T
+ Graphics.Gnuplot.ColorSpecification: rgb8 :: Word8 -> Word8 -> Word8 -> T
+ Graphics.Gnuplot.ColorSpecification: royalblue :: T
+ Graphics.Gnuplot.ColorSpecification: salmon :: T
+ Graphics.Gnuplot.ColorSpecification: seaGreen :: T
+ Graphics.Gnuplot.ColorSpecification: skyblue :: T
+ Graphics.Gnuplot.ColorSpecification: springGreen :: T
+ Graphics.Gnuplot.ColorSpecification: turquoise :: T
+ Graphics.Gnuplot.ColorSpecification: violet :: T
+ Graphics.Gnuplot.ColorSpecification: white :: T
+ Graphics.Gnuplot.ColorSpecification: yellow :: T
+ Graphics.Gnuplot.LineSpecification: lineColor :: T -> T -> T
Files
- gnuplot.cabal +14/−3
- src/Graphics/Gnuplot/ColorSpecification.hs +307/−0
- src/Graphics/Gnuplot/Frame/OptionSet.hs +12/−5
- src/Graphics/Gnuplot/LineSpecification.hs +1/−0
- src/Graphics/Gnuplot/Private/ColorSpecification.hs +22/−0
- src/Graphics/Gnuplot/Private/LineSpecification.hs +8/−1
gnuplot.cabal view
@@ -1,5 +1,5 @@ Name: gnuplot-Version: 0.4.1.1+Version: 0.4.2 License: BSD3 License-File: LICENSE Author: Henning Thielemann <haskell@henning-thielemann.de>@@ -33,8 +33,8 @@ you can switch to more convenient but probably less portable ways of feeding gnuplot with a script.-Tested-With: GHC==6.8.2, GHC==7.0.1-Cabal-Version: >=1.2+Tested-With: GHC==6.8.2, GHC==6.12.3, GHC==7.0.2+Cabal-Version: >=1.6 Build-Type: Simple Extra-Source-Files: Makefile@@ -44,6 +44,15 @@ Data-Files: data/runtime.data +Source-Repository this+ Tag: 0.4.2+ Type: darcs+ Location: http://code.haskell.org/gnuplot/++Source-Repository head+ Type: darcs+ Location: http://code.haskell.org/gnuplot/+ Flag splitBase description: Choose the new smaller, split-up base package. @@ -107,12 +116,14 @@ Graphics.Gnuplot.Graph.TwoDimensional Graphics.Gnuplot.Graph.ThreeDimensional Graphics.Gnuplot.LineSpecification+ Graphics.Gnuplot.ColorSpecification Graphics.Gnuplot.MultiPlot Graphics.Gnuplot.Value.Atom Graphics.Gnuplot.Value.Tuple Graphics.Gnuplot.Value.ColumnSet Other-Modules: Graphics.Gnuplot.Private.LineSpecification+ Graphics.Gnuplot.Private.ColorSpecification Graphics.Gnuplot.Private.Plot Graphics.Gnuplot.Private.Frame Graphics.Gnuplot.Private.FrameOption
+ src/Graphics/Gnuplot/ColorSpecification.hs view
@@ -0,0 +1,307 @@+module Graphics.Gnuplot.ColorSpecification (+ T,+ rgb,+ rgb8,+ name,+ paletteFrac,++ white,+ black,+ gray0,+ grey0,+ gray10,+ grey10,+ gray20,+ grey20,+ gray30,+ grey30,+ gray40,+ grey40,+ gray50,+ grey50,+ gray60,+ grey60,+ gray70,+ grey70,+ gray80,+ grey80,+ gray90,+ grey90,+ gray100,+ grey100,+ gray,+ grey,+ lightGray,+ lightGrey,+ darkGray,+ darkGrey,+ red,+ lightRed,+ darkRed,+ yellow,+ lightYellow,+ darkYellow,+ green,+ lightGreen,+ darkGreen,+ springGreen,+ forestGreen,+ seaGreen,+ blue,+ lightBlue,+ darkBlue,+ midnightBlue,+ navy,+ mediumBlue,+ royalblue,+ skyblue,+ cyan,+ lightCyan,+ darkCyan,+ magenta,+ lightMagenta,+ darkMagenta,+ turquoise,+ lightTurquoise,+ darkTurquoise,+ pink,+ lightPink,+ darkPink,+ coral,+ lightCoral,+ orangeRed,+ salmon,+ lightSalmon,+ darkSalmon,+ aquamarine,+ khaki,+ darkKhaki,+ goldenrod,+ lightGoldenrod,+ darkGoldenrod,+ gold,+ beige,+ brown,+ orange,+ darkOrange,+ violet,+ darkViolet,+ plum,+ purple,++ ) where++import qualified Graphics.Gnuplot.Private.ColorSpecification as Color+import Graphics.Gnuplot.Private.ColorSpecification (T, )+import Data.Ord.HT (limit, )+import Data.Word (Word8, )+++{- |+Color components for Red, Green, Blue, must be in the range @[0,1]@.+-}+rgb :: Double -> Double -> Double -> T+rgb r g b =+ rgb8 (word8FromDouble r) (word8FromDouble g) (word8FromDouble b)++word8FromDouble :: Double -> Word8+word8FromDouble c =+ round (limit (0,1) c * 255)++rgb8 :: Word8 -> Word8 -> Word8 -> T+rgb8 = Color.RGB8++paletteFrac :: Double -> T+paletteFrac = Color.PaletteFrac++{- |+Specify a color by name.+You are responsible for choosing an existing name in gnuplot.+If your color is available as Haskell variable in this module,+then prefer this one.+-}+name :: String -> T+name = Color.Name+++{-+This function chooses how we represent below colors in gnuplot.+If we use RGB values then we stay independent from the available color names+in the current gnuplot version.+If we use color names, then the generated gnuplot scripts are more readable.+-}+makeColor :: String -> Int -> Word8 -> Word8 -> Word8 -> T+makeColor str _ _ _ _ = name str+++white,+ black,+ gray0,+ grey0,+ gray10,+ grey10,+ gray20,+ grey20,+ gray30,+ grey30,+ gray40,+ grey40,+ gray50,+ grey50,+ gray60,+ grey60,+ gray70,+ grey70,+ gray80,+ grey80,+ gray90,+ grey90,+ gray100,+ grey100,+ gray,+ grey,+ lightGray,+ lightGrey,+ darkGray,+ darkGrey,+ red,+ lightRed,+ darkRed,+ yellow,+ lightYellow,+ darkYellow,+ green,+ lightGreen,+ darkGreen,+ springGreen,+ forestGreen,+ seaGreen,+ blue,+ lightBlue,+ darkBlue,+ midnightBlue,+ navy,+ mediumBlue,+ royalblue,+ skyblue,+ cyan,+ lightCyan,+ darkCyan,+ magenta,+ lightMagenta,+ darkMagenta,+ turquoise,+ lightTurquoise,+ darkTurquoise,+ pink,+ lightPink,+ darkPink,+ coral,+ lightCoral,+ orangeRed,+ salmon,+ lightSalmon,+ darkSalmon,+ aquamarine,+ khaki,+ darkKhaki,+ goldenrod,+ lightGoldenrod,+ darkGoldenrod,+ gold,+ beige,+ brown,+ orange,+ darkOrange,+ violet,+ darkViolet,+ plum,+ purple :: T++{-+gnuplot> show colornames+-}++white = makeColor "white" 0xffffff 255 255 255+black = makeColor "black" 0x000000 0 0 0+gray0 = makeColor "gray0" 0x000000 0 0 0+grey0 = makeColor "grey0" 0x000000 0 0 0+gray10 = makeColor "gray10" 0x1a1a1a 26 26 26+grey10 = makeColor "grey10" 0x1a1a1a 26 26 26+gray20 = makeColor "gray20" 0x333333 51 51 51+grey20 = makeColor "grey20" 0x333333 51 51 51+gray30 = makeColor "gray30" 0x4d4d4d 77 77 77+grey30 = makeColor "grey30" 0x4d4d4d 77 77 77+gray40 = makeColor "gray40" 0x666666 102 102 102+grey40 = makeColor "grey40" 0x666666 102 102 102+gray50 = makeColor "gray50" 0x7f7f7f 127 127 127+grey50 = makeColor "grey50" 0x7f7f7f 127 127 127+gray60 = makeColor "gray60" 0x999999 153 153 153+grey60 = makeColor "grey60" 0x999999 153 153 153+gray70 = makeColor "gray70" 0xb3b3b3 179 179 179+grey70 = makeColor "grey70" 0xb3b3b3 179 179 179+gray80 = makeColor "gray80" 0xcccccc 204 204 204+grey80 = makeColor "grey80" 0xcccccc 204 204 204+gray90 = makeColor "gray90" 0xe5e5e5 229 229 229+grey90 = makeColor "grey90" 0xe5e5e5 229 229 229+gray100 = makeColor "gray100" 0xffffff 255 255 255+grey100 = makeColor "grey100" 0xffffff 255 255 255+gray = makeColor "gray" 0xbebebe 190 190 190+grey = makeColor "grey" 0xbebebe 190 190 190+lightGray = makeColor "light-gray" 0xd3d3d3 211 211 211+lightGrey = makeColor "light-grey" 0xd3d3d3 211 211 211+darkGray = makeColor "dark-gray" 0xa9a9a9 169 169 169+darkGrey = makeColor "dark-grey" 0xa9a9a9 169 169 169+red = makeColor "red" 0xff0000 255 0 0+lightRed = makeColor "light-red" 0xf03232 240 50 50+darkRed = makeColor "dark-red" 0x8b0000 139 0 0+yellow = makeColor "yellow" 0xffff00 255 255 0+lightYellow = makeColor "light-yellow" 0xffffe0 255 255 224+darkYellow = makeColor "dark-yellow" 0xc8c800 200 200 0+green = makeColor "green" 0x00ff00 0 255 0+lightGreen = makeColor "light-green" 0x90ee90 144 238 144+darkGreen = makeColor "dark-green" 0x006400 0 100 0+springGreen = makeColor "spring-green" 0x00ff7f 0 255 127+forestGreen = makeColor "forest-green" 0x228b22 34 139 34+seaGreen = makeColor "sea-green" 0x2e8b57 46 139 87+blue = makeColor "blue" 0x0000ff 0 0 255+lightBlue = makeColor "light-blue" 0xadd8e6 173 216 230+darkBlue = makeColor "dark-blue" 0x00008b 0 0 139+midnightBlue = makeColor "midnight-blue" 0x191970 25 25 112+navy = makeColor "navy" 0x000080 0 0 128+mediumBlue = makeColor "medium-blue" 0x0000cd 0 0 205+royalblue = makeColor "royalblue" 0x4169e1 65 105 225+skyblue = makeColor "skyblue" 0x87ceeb 135 206 235+cyan = makeColor "cyan" 0x00ffff 0 255 255+lightCyan = makeColor "light-cyan" 0xe0ffff 224 255 255+darkCyan = makeColor "dark-cyan" 0x008b8b 0 139 139+magenta = makeColor "magenta" 0xff00ff 255 0 255+lightMagenta = makeColor "light-magenta" 0xf055f0 240 85 240+darkMagenta = makeColor "dark-magenta" 0x8b008b 139 0 139+turquoise = makeColor "turquoise" 0x40e0d0 64 224 208+lightTurquoise = makeColor "light-turquoise" 0xafeeee 175 238 238+darkTurquoise = makeColor "dark-turquoise" 0x00ced1 0 206 209+pink = makeColor "pink" 0xffc0cb 255 192 203+lightPink = makeColor "light-pink" 0xffb6c1 255 182 193+darkPink = makeColor "dark-pink" 0xff1493 255 20 147+coral = makeColor "coral" 0xff7f50 255 127 80+lightCoral = makeColor "light-coral" 0xf08080 240 128 128+orangeRed = makeColor "orange-red" 0xff4500 255 69 0+salmon = makeColor "salmon" 0xfa8072 250 128 114+lightSalmon = makeColor "light-salmon" 0xffa07a 255 160 122+darkSalmon = makeColor "dark-salmon" 0xe9967a 233 150 122+aquamarine = makeColor "aquamarine" 0x7fffd4 127 255 212+khaki = makeColor "khaki" 0xf0e68c 240 230 140+darkKhaki = makeColor "dark-khaki" 0xbdb76b 189 183 107+goldenrod = makeColor "goldenrod" 0xdaa520 218 165 32+lightGoldenrod = makeColor "light-goldenrod" 0xeedd82 238 221 130+darkGoldenrod = makeColor "dark-goldenrod" 0xb8860b 184 134 11+gold = makeColor "gold" 0xffd700 255 215 0+beige = makeColor "beige" 0xf5f5dc 245 245 220+brown = makeColor "brown" 0xa52a2a 165 42 42+orange = makeColor "orange" 0xffa500 255 165 0+darkOrange = makeColor "dark-orange" 0xff8c00 255 140 0+violet = makeColor "violet" 0xee82ee 238 130 238+darkViolet = makeColor "dark-violet" 0x9400d3 148 0 211+plum = makeColor "plum" 0xdda0dd 221 160 221+purple = makeColor "purple" 0xa020f0 160 32 240
src/Graphics/Gnuplot/Frame/OptionSet.hs view
@@ -95,11 +95,18 @@ (Atom.C a, Tuple.C a, Graph.C graph) => Option.T -> (a, a) -> T graph -> T graph range opt (x,y) =- let fromSingleton = \[s] -> s- in OptionSet.add opt- [showString "[" . fromSingleton (Tuple.text x) .- showString ":" . fromSingleton (Tuple.text y) $- "]"]+ OptionSet.add opt+ [showString "[" . atomText x .+ showString ":" . atomText y $+ "]"]++atomText ::+ (Atom.C a, Tuple.C a) =>+ a -> ShowS+atomText x =+ case Tuple.text x of+ [s] -> s+ _ -> error "OptionSet.fromSingleton: types of Atom class must generate single representation texts" xLabel :: Graph.C graph => String -> T graph -> T graph
src/Graphics/Gnuplot/LineSpecification.hs view
@@ -6,6 +6,7 @@ lineStyle, lineType, lineWidth,+ lineColor, pointType, pointSize, title,
+ src/Graphics/Gnuplot/Private/ColorSpecification.hs view
@@ -0,0 +1,22 @@+module Graphics.Gnuplot.Private.ColorSpecification where++import Graphics.Gnuplot.Utility (quote, )+import Data.List.HT (padLeft, )+import Data.Word (Word8, )+import Numeric (showHex, )+++data T =+ Name String+ | RGB8 {red, green, blue :: Word8}+ | PaletteFrac Double+++toString :: T -> String+toString c =+ case c of+ Name name -> "rgbcolor " ++ quote name+ RGB8 r g b ->+ "rgbcolor #" +++ concatMap (padLeft '0' 2 . flip showHex "") [r,g,b]+ PaletteFrac frac -> "palette frac " ++ show frac
src/Graphics/Gnuplot/Private/LineSpecification.hs view
@@ -1,5 +1,6 @@ module Graphics.Gnuplot.Private.LineSpecification where +import qualified Graphics.Gnuplot.Private.ColorSpecification as Color import Data.Maybe (catMaybes, ) import Graphics.Gnuplot.Utility (quote, ) @@ -14,6 +15,7 @@ { lineStyle_ :: Maybe Int , lineType_ :: Maybe Int , lineWidth_ :: Maybe Double+ , lineColor_ :: Maybe Color.T , pointType_ :: Maybe Int , pointSize_ :: Maybe Double , title_ :: Maybe String@@ -25,6 +27,7 @@ { lineStyle_ = Nothing , lineType_ = Nothing , lineWidth_ = Nothing+ , lineColor_ = Nothing , pointType_ = Nothing , pointSize_ = Nothing , title_ = Nothing@@ -39,6 +42,9 @@ lineWidth :: Double -> T -> T lineWidth x ls = ls{lineWidth_ = Just x} +lineColor :: Color.T -> T -> T+lineColor x ls = ls{lineColor_ = Just x}+ pointType :: Int -> T -> T pointType x ls = ls{pointType_ = Just x} @@ -54,10 +60,11 @@ let showField :: String -> (a -> String) -> (T -> Maybe a) -> Maybe [String] showField s f access = fmap (\a -> [s, f a]) $ access linespec in unwords $ concat $ catMaybes $+ showField "linestyle" show lineStyle_ : showField "linetype" show lineType_ : showField "linewidth" show lineWidth_ :+ showField "linecolor" Color.toString lineColor_ : showField "pointtype" show pointType_ : showField "pointsize" show pointSize_ : showField "title" quote title_ :- showField "linestyle" show lineStyle_ : []