I had started thinking about this problem recently too and also had broken 
it down to two parts. I was going to create a simple data frame protocol 
for a) and a ggplot2-inspired library which emits SVG for b). There is 
prior work for plotting in Incanter (using JFreeChart) and David Liebke 
also started a SVG-emitting plot library, Analemma 
(https://github.com/liebke/analemma). I believe there is some sort of data 
frame implementation in Incanter.

My motivation was for simple libraries which could be used to generate 
well-designed figures. I frequently end up exporting data from Clojure to R 
only for ggplot2. Having a data frame is useful for designing the plotting 
API or quickly collecting aggregate statistics for certain attributes or 
factor levels.

On Friday, December 12, 2014 4:29:37 AM UTC-5, Mike Anderson wrote:
>
> Lucas,
>
> Thanks for kicking off the discussion - great to see your proposal on 
> this. I think it will be really valuable if we can converge on a standard 
> way of representing this kind of data in Clojure/ClojureScript. Copying the 
> Incanter and main Clojure groups as well because I think there will be 
> broad interest in this.
>
> My view is that it is worth distinguishing (decomplecting?) two things:
>
> a) The format used to convey the actual data, i.e. the labelled ":dataset" 
> part of the data format suggested below
> b) The format used to specify the chart (chart type, axes etc.)
>
> I think a) Can be pretty closely linked to the standard core.matrix 
> dataset / n-dimensional array structure. 
>
> b) is much harder and may call for something more like ggplot2, also worth 
> checking out Kevin Lynagh's c2 work (https://keminglabs.com/c2/)
>
> Therefore it may be easier to tackle a) in isolation first. b) will 
> probably need more experimentation before we can settle on something 
> sufficiently well designed and general.
>  
> On Thursday, 11 December 2014 17:45:00 UTC+8, Lucas Bradstreet wrote:
>>
>> Hi everyone,
>>
>> We are currently writing an OM based visualisation / charting library 
>> that we
>> intend to use extensively in combination with core.matrix and other data
>> analysis libraries/tools (e.g. gorilla REPL, incanter, etc). 
>>
>> Some of the goals of this library:
>> - Provide a clojurescript wrapper for common visualisation libraries (C3,
>>   dimple, Rickshaw, NVD3) for standard charting features.
>> - Provide a generic data format, with conversion functions to native 
>> charting
>>   library formats.
>> - Provide transformation functions between core.matrix datasets, incanter
>>   datasets, etc to this generic charting format.
>> - Provide update functions to allow datasets to seamlessly be updated 
>> with the
>>   addition of data-points in map and vector formats.
>> - Provide seamless transitions when a dataset is updated, ala om.
>>
>> We would like to hear any of your thoughts regarding the following 
>> charting
>> data format below. This format maps fairly closely to core.matrix datasets
>> (note, although core.matrix datasets currently do not allow labelled
>> dimensions, this support is incoming).
>>
>> {:axes [{:label "X axis label" :type :category}
>> {:label "Y axis label" :type :category}
>> {:label "Z axis label" :type :measure}
>> {:label "C axis label" :type :color}]
>>    :chart-type :area
>>    :dataset {:labels [; 0th dimension is labelled from the 0th dimension 
>> of the 1st
>>          ; 1st dimension labels (i.e. columns)
>>               ["timestamp" "event-count" "magnitude" "colour"]
>>       ; 2nd dimension labels (i.e. series)
>>                       ["series1" "series2" "series3"]] 
>>              :data [[; series 1 data
>>      [1 2 3 4] ; timestamp values
>>                      [100 200 300 400] ; event count value
>>                      [50 100 150 200] ; magnitude values
>>                      [25 50 75 100] ; colour values
>>      ]
>>                     [[1 2 3 4]
>>                      [1 200 3 4] 
>>                      [5 7 444 8] 
>>                      [9 10 11 12]]
>>                     [[1 2 3 4]
>>                      [1 2 3 4] 
>>                      [5 9 7 8] 
>>                      [9 10 11 12]]]}}
>>
>> The above format is close to the native format used by C3, and can be 
>> easily mapped
>> to a format that is more easily consumed by dimple charts:
>>
>> {:axes [{:key "timestamp", :type :category, :label "X axis label"} 
>>         {:key "event-count", :type :category, :label "Y axis label"} 
>>         {:key "magnitude", :type :measure, :label "Z axis label"} 
>>         {:key "colour", :type :color, :label "C axis label"}], 
>>  :chart-type :area, 
>>  :dataset [{:name "series1", 
>>             :values [{"colour" 25, "magnitude" 50, "event-count" 100, 
>> "timestamp" 1} 
>>                      {"colour" 50, "magnitude" 100, "event-count" 200, 
>> "timestamp" 2} 
>>                      {"colour" 75, "magnitude" 150, "event-count" 300, 
>> "timestamp" 3} 
>>                      {"colour" 100, "magnitude" 200, "event-count" 400, 
>> "timestamp" 4}]} 
>>            {:name "series2", 
>>             :values [{"colour" 9, "magnitude" 5, "event-count" 1, 
>> "timestamp" 1} 
>>                      {"colour" 10, "magnitude" 7, "event-count" 200, 
>> "timestamp" 2}
>>                      {"colour" 11, "magnitude" 444, "event-count" 3, 
>> "timestamp" 3}
>>                      {"colour" 12, "magnitude" 8, "event-count" 4, 
>> "timestamp" 4}]}
>>            {:name "series3", 
>>             :values [{"colour" 9, "magnitude" 5, "event-count" 1, 
>> "timestamp" 1}
>>                      {"colour" 10, "magnitude" 9, "event-count" 2, 
>> "timestamp" 2}
>>                      {"colour" 11, "magnitude" 7, "event-count" 3, 
>> "timestamp" 3}
>>                      {"colour" 12, "magnitude" 8, "event-count" 4, 
>> "timestamp" 4}]}]}
>>
>>
>> We would love to hear any feedback of any kind on this format.
>>
>> Thanks,
>>
>> Lucas
>>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to