[Chart] the grammar of graphics

Tim Docker tim at dockerz.net
Wed Mar 26 10:55:03 GMT 2014


Yes. The existing Plot x y type is a monoid instance - though mappend is 
currently called joinPlot.

I guess this means that layouts could take a single plot value, in lieu 
of a list:

data Layout x y = Layout {
    ...
   _layout_plot           :: Plot x y
   ...
}

Slightly tidier... Is this a worthwhile change?

Tim


On 26/03/14 21:00, Malcolm Wallace wrote:
> I think the obvious monoidal operation on charts is "overlay".  This would require the signature:
>
> mappend :: Plot x y -> Plot x y -> Plot x y
>
> Regards,
>      Malcolm
>
> On 26 Mar 2014, at 08:44, Tim Docker wrote:
>
>> Thanks for the reply.
>>
>> What do you mean by a monoidal structure? Some parts of the existing chart are lists (eg the plots shown on a chart, or the charts to be stacked) so are monoids in a trivial sense. Do you mean something deeper?
>>
>> A chart definition is currently a pure value (though rendering one is not). Are you suggesting there should be a monadic wrapper to construct the pure values as syntactic sugar?
>>
>> Tim
>>
>> On 22 Mar 2014 10:12, "Carter Schonwald" <carter.schonwald at gmail.com> wrote:
>> woops, got a bit side tracked
>>
>>
>> the GOG book is very very old school OOP,
>> the modern ggplot2 lib is slightly different, hadley has a bajillion examples online + a fairly affordable tiny book walking you through how to use it.
>>
>>
>> that said, a lot of ggplot2 comes down to have a monoidal configuration with good defaults and a monadic interface for the monoidal config, plus some good default for stacking plots and layering them too!
>>
>> Theres also that ggplot2 uses R data frames + math modelling tools quite heavily to the point where it hard to talk about them in isolation. Theres a reason why I'm working on numerical haskell! :)  (actually, i'm serious, thats what got me started originally)
>>
>> a friend of  mine started a prototype of "ggplot2 style thing done right in haskell, with diagrams for rendering + lens for the query / data manipulation language" here https://github.com/cscheid/plots Its not really meant for real use. But you might be able to get some basic ideas from there
>>
>>
>>
>>
>>
>>
>> On Thu, Mar 20, 2014 at 11:10 PM, Tim Docker <tim at dockerz.net> wrote:
>> Hi Carter - I'd still like to here this if/when you have time.
>>
>>
>> On 14/03/14 11:32, Carter Schonwald wrote:
>>> hey tim,
>>> you don't need that book, i'll reply later this evening explaining the key insight :)
>>>
>>>
>>> On Thu, Mar 13, 2014 at 6:31 PM, Tim Docker <tim at dockerz.net> wrote:
>>> Hi,
>>>
>>> In developing the API for the chart library, there's always been a tension between type-safety and flexibility, versus suitability for quick and easy use. The current API works fine, but there's still more syntax than I'd like to get a chart into a window.
>>>
>>> People involved in data analysis and statistics, often cite various libraries as being pleasingly easy to use, (eg: http://ggplot2.org/) and these libraries often claim to be based upon this book:
>>>
>>> http://www.amazon.com/Grammar-Graphics-Statistics-Computing/dp/0387245448
>>>
>>> Has anyone looked at this book, or have an online reference to something describing it's key ideas? It's an expensive book to buy without knowing that it's going to be worthwhile.
>>>
>>> Tim
>>>
>>> _______________________________________________
>>> Chart mailing list
>>> Chart at projects.haskell.org
>>> http://projects.haskell.org/cgi-bin/mailman/listinfo/chart
>>>
>>
>> _______________________________________________
>> Chart mailing list
>> Chart at projects.haskell.org
>> http://projects.haskell.org/cgi-bin/mailman/listinfo/chart




More information about the Chart mailing list