From gershomb at gmail.com Sun Feb 15 20:09:50 2015 From: gershomb at gmail.com (Gershom B) Date: Sun, 15 Feb 2015 15:09:50 -0500 Subject: [Numeric] Welcome to the Numeric Haskell List Message-ID: Frist Post! (sorry/notsorry) ?gershom From dominic at steinitz.org Tue Feb 17 17:41:41 2015 From: dominic at steinitz.org (Dominic Steinitz) Date: Tue, 17 Feb 2015 17:41:41 +0000 Subject: [Numeric] ggplot for Haskell (was Re: [diagrams] Using charts in blogliteratelyd) In-Reply-To: <87mw4dbe2v.fsf@Chladni.home> References: <25866f6f-4438-45a7-91ed-8e8eea9c3dec@googlegroups.com> <87mw4dbe2v.fsf@Chladni.home> Message-ID: Hi Daniel, Thanks for your comprehensive reply. > I don't feel like I understand the design space enough to start such a > project, but I'd contribute if someone gets it started, or I'd discuss > it more first. I am pretty sure I don't understand the design space either. > Can you say a bit about what a library needs to be "like ggplot", > rather than like other graphing libraries? Is it mostly about > separating the graph description from the data, and composable > abstractions for the graph to support things like faceting? I think we can already do faceting e.g. https://idontgetoutmuch.files.wordpress.com/2014/06/044408c77f048f73.png?w=1560 I had a quick look at http://byrneslab.net/classes/biol607/readings/wickham_layered-grammar.pdf I may have misunderstood but I think it has a limited scope and calling it a grammar of graphics suggests in can do more than it actually can. That is not to be critical: it is very powerful just not as powerful as the name suggests. What I wanted to draw was something like this: http://www.helsinki.fi/varieng/series/volumes/07/siirtola_et_al/figures/sfigure12.png but that uses a package called Beanplot (http://www.jstatsoft.org/v28/c01/paper) not ggplot. I actually managed to sketch something that was close to what I wanted using diagrams (not chart). http://i.imgur.com/TeyloXA.png So I feel we are quite close to something that is more powerful than ggplot. But my attempts both at the above and at facets are not very flexible / re-usable. However, I feel I am re-inventing the charts wheel. What I feel I need is access to the chart components not to just be able to create a chart. Maybe we should talk directly to the author of charts. I don't think it is possible to create the above example using charts. A further thing one can't do with charts is annotations. I believe one can do this in ggplot. I think as you suggest, we need composable abstractions. For my example, I created a grid and overlaid the histograms on top of it. I'd like to overlay axes on it as well and a legend. > I've used Chart (in Haskell) and ggplot a little, but mostly have > experience with Python using matplotlib & pandas. The last time I > looked at making an R / pandas environment in Haskell, I got bogged > down in picking a dataframe type. tables[1] & Frames[2] both look > relevant. I've used frames and pandas a bit. As far as I understand it they carry around a description of the data along with the data; ggplot can then make use of this. I don't see it as essential and I wouldn't want "ggplot in Haskell" to depend on either tables or frames Maybe we could start "ggplot in Haskell" by somehow generalizing my feeble examples? Dominic Steinitz dominic at steinitz.org http://idontgetoutmuch.wordpress.com On 17 Feb 2015, at 00:02, Daniel Bergey wrote: > On 2015-02-16 at 09:15, idontgetoutmuch wrote: >> 2. Why does haskell-chart load fonts but diagrams itself doesn't? Does >> diagrams generate fonts on the fly somehow? > > The answer depends on which Diagrams Backend you are using. Backends > which output raster images load the fonts they use. Vector output > formats may get away refering to the font name, and expecting the viewer > to load the font. Some vector backends can access font metrics to > position (eg, center) text. > > I may be wrong about some of the following table: > > | Backend | Embed Font / bitmap | Font Metrics | > |------------+--------------------------+--------------| > | Cairo | depends on output format | Y | > | SVG | N | partial | > | Rasterific | Y | partial | > | Canvas | N | partial | > > I believe Chart loads fonts to provide better text positioning than the > Diagrams Backends currently support. I think there's some low-hanging > fruit, here, notably > https://github.com/diagrams/diagrams-rasterific/issues/21 > now that Rasterific has the needed feature. > >> 3. Has anyone shown any interest in writing something like ggplot using >> diagrams? This would be a fantastic tool but wouldn't be a trivial >> undertaking. > > Quite a few people have expressed interest in *using* such a library. I > haven't heard anyone say they have time to write it, but maybe between > us we do. > > I don't feel like I understand the design space enough to start such a > project, but I'd contribute if someone gets it started, or I'd discuss > it more first. > > Can you say a bit about what a library needs to be "like ggplot", rather > than like other graphing libraries? Is it mostly about separating the > graph description from the data, and composable abstractions for the > graph to support things like faceting? > > I've used Chart (in Haskell) and ggplot a little, but mostly have > experience with Python using matplotlib & pandas. The last time I > looked at making an R / pandas environment in Haskell, I got bogged down > in picking a dataframe type. tables[1] & Frames[2] both look relevant. > > cheers, > bergey > > Footnotes: > [1] http://hackage.haskell.org/package/tables > > [2] https://github.com/acowley/Frames > From dominic at steinitz.org Mon Feb 23 20:07:44 2015 From: dominic at steinitz.org (Dominic Steinitz) Date: Mon, 23 Feb 2015 20:07:44 +0000 Subject: [Numeric] ggplot for Haskell (was Re: [diagrams] Using charts in blogliteratelyd) In-Reply-To: <87zj84tyo8.fsf@Chladni.home> References: <25866f6f-4438-45a7-91ed-8e8eea9c3dec@googlegroups.com> <87mw4dbe2v.fsf@Chladni.home> <87zj84tyo8.fsf@Chladni.home> Message-ID: Dominic Steinitz dominic at steinitz.org http://idontgetoutmuch.wordpress.com On 23 Feb 2015, at 15:50, Daniel Bergey wrote: > On 2015-02-17 at 17:41, Dominic Steinitz wrote: >> I think we can already do faceting e.g. >> >> https://idontgetoutmuch.files.wordpress.com/2014/06/044408c77f048f73.png?w=1560 >> http://www.helsinki.fi/varieng/series/volumes/07/siirtola_et_al/figures/sfigure12.png > > How does Chart handle axes bounds when faceting? This is an example > where I believe ggplot outshines matplotlib. matplotlib does a good job > picking axes bounds & tickmarks for a single plot, but if I make two > subplots, it picks bounds separately for each. To get them aligned on > one or both axes, I need to specify bounds myself. ggplot by default > plots each subplot with matching bounds on the matching axes. I should have been clearer - my apologies. chart does *not* do faceting; I transform multiple charts into diagrams and then lay these out in whatever way is appropriate. I can create each chart with identical axes and so get the ggplot experience. > >> but that uses a package called Beanplot >> (http://www.jstatsoft.org/v28/c01/paper) not ggplot. > > That's a cool graph. I've seen symmetric "violin plots" before, with > the same univariate distribution plotted on each side of the vertical > whiskers. I think I prefer this version, with a different category on > each side. I think to do something like this I need to be able to access the components of a chart and be able to create new sorts of components; I don?t believe the former is possible at the moment although I think the latter is (I recall someone just submitted a pull request to produce histograms).