module Graphics.Rendering.Plot.Figure.Plot.Legend (
Legend
, LegendBorder
, LegendLocation(..), LegendOrientation(..)
, clearLegend
, setLegend
, withLegendFormat
) where
import Control.Monad.State
import Control.Monad.Reader
import Graphics.Rendering.Plot.Types
import Graphics.Rendering.Plot.Defaults
import Graphics.Rendering.Plot.Figure.Text
clearLegend :: Legend ()
clearLegend = put Nothing
setLegend :: LegendBorder -> LegendLocation -> LegendOrientation -> Legend ()
setLegend b l o = do
to <- ask
put $ Just $ Legend b l o (scaleFontSize legendLabelScale to)
withLegendFormat :: Text () -> Legend ()
withLegendFormat m = do
l <- get
let legend = case l of
Nothing -> defaultLegend
Just l' -> l'
to' <- ask
let (FontText to _) = execText m to' (FontText to' "")
put $ Just $ legend { _leg_fmt = to }