matplotlib-0.3.0: Bindings to Matplotlib; a Python plotting library

Safe HaskellNone
LanguageHaskell2010

Graphics.Matplotlib.Internal

Description

Internal representations of the Matplotlib data. These are not API-stable and may change. You can easily extend the provided bindings without relying on the internals exposed here but they are provided just in case.

Synopsis

Documentation

mapLinear :: (Double -> b) -> Double -> Double -> Double -> [b] Source #

A handy miscellaneous function to linearly map over a range of numbers in a given number of steps

Basics

data Matplotlib Source #

The wrapper type for a matplotlib computation.

Constructors

Matplotlib 

Fields

data MplotCommand Source #

A maplotlib command, right now we have a very shallow embedding essentially dealing in strings containing python code as well as the ability to load data. The loaded data should be a json object.

Constructors

LoadData ByteString 
Exec 

Fields

data Option Source #

Throughout the API we need to accept options in order to expose matplotlib's many configuration options.

Constructors

K String String

results in a=b

P String

just inserts the option verbatim as an argument at the end of the function

toPy :: MplotCommand -> String Source #

Convert an MplotCommand to python code, doesn't do much right now

resolvePending :: Matplotlib -> Matplotlib Source #

Resolve the pending command with no options provided.

withMplot :: Matplotlib -> ([String] -> IO a) -> IO a Source #

The io action is given a list of python commands to execute (note that these are commands in the sense of lines of python code; each inidivudal line may not be parseable on its own

mplotString :: String -> Matplotlib Source #

Create a plot that executes the string as python code

mp :: Matplotlib Source #

Create an empty plot. This the beginning of most plotting commands.

readData :: ToJSON a => a -> Matplotlib Source #

Load the given data into the 'data' array

(%) :: Matplotlib -> Matplotlib -> Matplotlib infixl 5 Source #

Combine two matplotlib commands

(#) :: MplotValue val => Matplotlib -> val -> Matplotlib infixl 6 Source #

Add Python code to the last matplotlib command

class MplotValue val where Source #

Values which can be combined together to form a matplotlib command. These specify how values are rendered in Python code.

Minimal complete definition

toPython

Methods

toPython :: val -> String Source #

Options

optFn :: ([Option] -> String) -> Matplotlib -> Matplotlib Source #

Add an option to the last matplotlib command. Commands can have only one option! optFn :: Matplotlib -> Matplotlib

options :: Matplotlib -> Matplotlib Source #

Merge two commands with options between

(##) :: MplotValue val => Matplotlib -> val -> Matplotlib infixl 6 Source #

A combinator like # that also inserts an option

renderOptions :: [Option] -> [Char] Source #

An internal helper to convert a list of options to the python code that applies those options in a call.

optionFn :: ([Option] -> [Option]) -> Matplotlib -> Matplotlib Source #

An internal helper that modifies the options of a plot.

option :: Matplotlib -> [Option] -> Matplotlib Source #

Apply a list of options to a plot resolving any pending options.

(@@) :: Matplotlib -> [Option] -> Matplotlib infixl 6 Source #

A combinator for option that applies a list of options to a plot

def :: Matplotlib -> [Option] -> Matplotlib Source #

Bind a list of default options to a plot. Positional options are kept in order and default that way as well. Keyword arguments are

defFn :: [Option] -> [Option] -> [Option] Source #

Python operations

python :: Foldable t => t String -> IO (Either String String) Source #

Run python given a code string.

pyIncludes :: [[Char]] Source #

The standard python includes of every plot

pyReadData :: [Char] -> [[Char]] Source #

The python command that reads external data into the python data array

pyDetach :: [[Char]] Source #

Detach python so we don't block (TODO This isn't working reliably)

pyOnscreen :: [[Char]] Source #

Python code to show a plot

pyFigure :: [Char] -> [[Char]] Source #

Python code that saves a figure

o1 :: String -> Option Source #

Create a positional option

o2 :: String -> String -> Option Source #

Create a keyword option