On Monday, October 17, 2016 at 3:37:51 PM UTC-5, Jean Niklas L'orange wrote: > > Hi Marshall, > > On 17 October 2016 at 07:54, Mars0i <mars...@logical.net <javascript:>> > wrote: > >> Looks very nice! Thanks Jean Niklas. I've been using Incanter for >> charts, which has been fine so far for my needs, but clj-xchart looks like >> it will make it easier to make nicer charts, and it would avoid loading >> much of Incanter when you don't need some of the other things Incanter >> provides. (I also use nvd3 to generate charts in a browser with >> Clojurescript.) >> > > Thanks! This was also parts of the rationale for clj-xchart as well: > Incanter is great, but it feels a bit strange to drag in both json and csv > dependencies if you only need to plot some charts. > > >> But if I'm plotting several sequences of y values that are embedded in a >> sequence of maps or vectors, each with several y values for the same x, I >> wonder if it could be more to efficient pass the entire complex sequence to >> the plotting function at once, and only provide one set of x values if all >> of the y values will share the same x's. If the plotting function extracts >> the y values as it reads through the sequence of maps/vectors, and needs >> only one sequence of x's, then only two sequences are realized. >> >> Maybe this is an unusual need, at present, but as Clojure is used for >> more scientific applications, it might become more common. >> > > XChart (and consequently clj-xchart) can take the same x-axis as input. So > you can reuse the same x values instead of creating 3 distinct but > identical ones: > > (let [x [1 2 3] > y1 [1 2 3] > y2 [2 4 6] > y3 [3 6 9]] > (c/xy-chart {"y1" {:x x :y y1} > "y2" {:x x :y y2} > "y3" {:x x :y y3}})) > > I don't think this is unique to clj-xchart though, the same should apply > to Incanter/JFreeChart. >
Right. I don't know why I didn't think of that. Good idea. Unfortunately, clj-xchart will indirectly realise almost all lists it is > given, as it calls .size() on them to ensure that the X/Y/error lists are > identical in size. It will also walk the lists to find the size/scale of > the chart to plot. I'm not sure if there's a way around that, except > perhaps if one pin the boundaries of the plot axes. > > That being said, it doesn't seem like a bad idea to provide some sort of > efficient view over data to avoid creating a new list that will be realised > with the exact same data in another list. I made an issue > <https://github.com/hyPiRion/clj-xchart/issues/5> on this, it shouldn't > be too hard to implement either. > Great. > For what it's worth, I've had the same "issue" with large datasets as well > (10-20M elements). In my case there isn't that much interesting to look at > except the occational outlier, or if you have values which differ extremely > from one datapoint to another. > > What I tend to do is rebin/shrink the data set, typically by computing the > average/max value of partitions (after filtering away outliers), depending > on what I need to plot. I have a small section in the "Gotchas" section > named Many Datapoints > <https://github.com/hyPiRion/clj-xchart/blob/master/docs/tutorial.md#many-datapoints> > (bottom > of the page) which has a couple of lines on how one can do that. I haven't > found a good generic interface for it yet, so it's not provided by > clj-xchart as of now. > Yes, good idea for some situations. For my present project, it's OK to simply use every 10th or 100th point, even when the data is wildly random, but sometimes I want to see them all. Other data elements are roughly continuous, so it's no problem to sample every nth point. -- 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.