Live data from Hacker News

D3 in Depth

d3indepth.com

61–70 of 84 posts

Re: D3 in Depth

#62
post #61

Can anyone recommend a good plotting library for Python, that is not matplotlib?

https://opensource.com/article/20/4/plot-data-python gives some common options. What kind of plots are you trying to achieve? Interactive? Jupyter notebooks? Reporting? SVG or HTML output? You might also like to look at things like https://evidence.dev

Re: D3 in Depth

#63
post #61

Can anyone recommend a good plotting library for Python, that is not matplotlib?

Vega/Vega-lite has a python interface called Altair.

I haven't used Altair but I wanted something higher level than D3 (which I've used but it feels fairly low level) so I went through the learning curve for Vega.js, and it could handle every usecase that I tried, some of which were pretty complex.

Re: D3 in Depth

#64
post #9

I like d3 and have built a lot of things in it but every time I go back to it after not using it for a few years, I can never remember much, the docs just confuse me more, and I feel like I’m back at square one. Whereas you could show me some partial differential equations to solve that I haven’t touched in 10 years and that somehow comes back quicker. But I also think the d3 reference docs are absolutely horrible to…

I have used D3 extensively to the point of building integrations for AngularJS and Angular for it. I have always found it to be exceptionally unintuitive even if it is quite powerful. It is easy to get wrong, hard to debug and hard to grok. Not saying this is an easy problem to solve either. If I needed to generate some very specific data driven graphics it would probably still be my go to.

So happy to read this in a few different comments. I took a data-viz class in college and just felt stupid because d3 didn't click for me.

Re: D3 in Depth

#65
post #7

Even if you never end up using it professionally, I think it's worth it to learn D3. The core point that the library makes is that your projection of the data (say, a 1080p screen, 1920x1080) is always different from the dimensions of the data itself (say, grading from 0-100). At some point you need to decide how to scale the data (0-100) so that it draws correctly according to the projection (1920x1080). You can do…

That's a good way of framing the core concept.

D3 was never intuitive for me. Maybe the problem is that it tries to do too much, at too many different level of abstraction? If it's just about projecting data, that's easy enough to understand. But I guess projection is also closely tied to axis and other pieces.

Re: D3 in Depth

#66

Earlier quoted context omitted.

So D3 is not what I’d consider a high-level library. The point of it is to be able to do all kinds of stuff not supported by your average charting solution’s out of the box histograms and whatnot. It’s a great way to make more bespoke visualizations. Of course sometimes you just want to make a damn histogram without reinventing the wheel which is where some of the niceties discussed above come in.

D3 runs in the browser and it manipulates DOM nodes, a very high level abstraction. You can accomplish something with it using SVG, which is again a high level abstraction. You can give it data and it will spit out numbers that you can use to draw something on the screen. You can bind that data to elements and it will keep track of what's entering and what's exiting. You can apply fancy transitions with a line of cod…

Fair enough. I meant specifically in the context of data visualization libraries, having done a fair bit of that sort of work in my own career. It’s harder to make a basic chart in d3, compared to many out of the box solutions, but it’s possible to do pretty much whatever you want, thanks to (what I consider) the low-ish level of abstraction it provides. I.e. DOM manipulation vs direct specification of standard chart attributes.

Re: D3 in Depth

#67
post #15

Earlier quoted context omitted.

Plot and Framework are locked into the Observable ecosystem, which has its own learning curve. Learning D3 offers the best flexibility and control.

In what way are these free open-source tools “locked-in” to Observable? Observable Plot is a vanilla JavaScript library that is released under the ISC license and can be used with any style of web development (e.g., React, Svelte, whatever). And likewise Observable Framework is released under the ISC license and you’re able to self-host projects anywhere and develop locally?

Mike, thank you for D3. It’s had a huge impact on me personally.

Re: D3 in Depth

#69
post #29

I love the visualizations created but something about D3 syntax has just never clicked for me. It seems overly convoluted, verbose and from an old era. We've thankfully moved to a more declarative way of doing things.

D3 is from jQuery era so there are a lot of methods for manually manipulating the DOM like d3.select() and then selection.attr() etc. but those patterns tend to lead to components that are lengthy, hard to read and hard to maintain. Arguably a better approach is to group each D3 module based on whether it "modifies DOM" or "doesn't modify DOM". Then use React/Svelte to declaratively render the DOM and only use the D3…

This exists, it’s called visx, and it’s great.

https://airbnb.io/visx

Re: D3 in Depth

#70

The real problem with D3 is that, as a library, it doesn't really do visualizations. It gives you functions and exmaples to compose your own visualizations, whose key requirement is an expert-level understanding of JavaScript (particularly closures and functional programming). What mbostock says is the core "abstraction" of D3, the select and select diffing, is only an affordance for writing reentrant "paint()", with…

Check out visx. It should really be called D4: Declarative Data Driven Documents. It swaps out d3-select (the DOM manipulation module of D3) in favor of React. That this is possible and works great is a testament to the great design of D3.
Post reply on HN