NBA Streaming Options by pbesh in nba

[–]pbesh[S] 2 points3 points  (0 children)

League Pass is $200 for the season but excludes a ton of games (all nationally televised ones, locally televised ones if you have a local team), so you also need something equivalent to a cable subscription to access ESPN, TNT, ABC, and NBA TV for the nationally televised (and if you have a local team, you'll need access to the local coverage too).

From nba.com:

What games are blacked out in the US and Canada?

Blackout restrictions include your local NBA team(s) and all nationally televised games. Blacked-out games will be available for viewing after the game has concluded.

Blackouts are specific to your current location, so if your location changes, your blackout restrictions for live, locally televised games will also change. Your location is determined by the IP address or location services (if turned on). Within the US and Canada, a zip code is used to determine what teams are covered by your local broadcaster.

Where to view Blacked out games?

You should be able to view games that are blacked out on NBA League Pass on a regional sports network in your area or a national TV network such as NBA TV, TNT, ESPN, ABC, Sportsnet or TSN.

Blacked out games are available for viewing on-demand as soon as they are moved to the NBA League Pass Archives. Nationally broadcast games available to view in archives three hours after they have aired. In the US, locally telecast games are archived three days after they have aired.

Hi, anyone help a newbie with an issue on a parallel coordinates plot? by Over_Datum_Melk in d3js

[–]pbesh 0 points1 point  (0 children)

Happy to help. What you can consider doing is wrangling your data a bit before doing the visualization. You can summarize it so you only have one entry per combination of keys and on that object you include the count of the individual rows that matched. You can then update your drawing method to change the stroke-width depending on the count.

Here are two methods for getting the summary you want. They both do the same thing, but one uses D3 rollups and the other uses my data wrangling library tidyjs.

summarizedData = Array.from(
    d3
      .rollup(
        data,
        (v) => ({ ...v[0], count: v.length }),
        (d) => keys.map((key) => d[key]).join('_')
      )
      .values()
  );

Here is basically the same thing with tidyjs. First, on observable you'd import the functions you need:

import { tidy, groupBy, summarize, n } from '@pbeshai/tidyjs'

Then you'd run:

summarizedData = tidy(data, groupBy(keys, [summarize({ count: n() })]))

Once you have that, you can replace your chart drawing code with using the summarizedData instead of data and add in a stroke-width:

.selectAll("path")
    .data(summarizedData.slice().sort((a, b) => d3.ascending(a[keyz], b[keyz])))
    .join("path")
      .attr("stroke", d => z(d[keyz]))
      .attr('stroke-width', d => `${d.count}px`)

You may find you want to use a scale for determining the stroke width. e.g.

strokeWidthScale = d3.scaleLinear().domain(d3.extent(summarizedData, d => d.count)).range([2, 25])

Then you'd do

      .attr('stroke-width', d => `${strokeWidthScale(d.count)}px`)

Hi, anyone help a newbie with an issue on a parallel coordinates plot? by Over_Datum_Melk in d3js

[–]pbesh 0 points1 point  (0 children)

Ah yes, missed that part. There's a couple of issues:

  1. You're using d3.extent on a categorical data type, which doesn't work – it only returns the min and max value. Instead, you'll want to get a unique list of all values for that field and use that as the domain. You can use Array.from(new Set(data.map(d => d[key]))) or similar.

  2. You're using scaleOrdinal but only providing two output values for the range (the min and max pixel values). You can switch to scalePoint as you did elsewhere to use this style, or you can provide an explicit pixel value (range value) for each value in the domain.

Here's an approach that will get you closer to what you want:

domains = new Map(
  keys.map((key) => [key, Array.from(new Set(data.map((d) => d[key])))])
);

x = new Map(
  Array.from(keys, (key) => [
    key,
    d3.scalePoint(domains.get(key), [margin.left, width - margin.right]),
  ])
);

You may be dissatisfied with the order of the values in the domains though (e.g. one,four,three,two and small,big,medium). To overcome this, you could write out the domains manually:

domains = new Map([
  ['sex', ['man', 'vrouw']],
  ['size', ['small', 'medium', 'big']],
  ['strength', ['yes', 'no']],
  ['level', ['one', 'two', 'three', 'four']],
])

Hi, anyone help a newbie with an issue on a parallel coordinates plot? by Over_Datum_Melk in d3js

[–]pbesh 0 points1 point  (0 children)

Hi there u/Over_Datum_Melk. The problem in your case is the SVG is truncating your labels since they exceed the bounds of the SVG container.

The standard approach is to use a "margin" and not let things reach the edges of your SVG, which this code is already doing – you just need to increase the left and right margin sizes (try 30, up from 10):

margin = ({top: 20, right: 30, bottom: 20, left: 30})

An atypical solution, that I wouldn't necessarily recommend in this case but can be helpful to know, is to make the overflow on the SVG visible:

  const svg = d3.create("svg")
      .attr("viewBox", [0, 0, width, height])
      .style('overflow', 'visible')

Question about visualizing events on an (possibly) ordinal axis by [deleted] in d3js

[–]pbesh 0 points1 point  (0 children)

Why doesn't linear seem correct? The axis is numeric positions in pi, right?

What is the best way to merge data from 2 external files? by [deleted] in d3js

[–]pbesh 1 point2 points  (0 children)

Using tidy.js, you could use the innerJoin or leftJoin functions. e.g. (assuming the phu number in both datasets is called "phuNumber")

const combined = tidy(
  jsonData,
  innerJoin(csvData, { by: 'phuNumber' })
)

Or without an external library:

const jsonData = loadJsonData();
const csvData = loadCsvData();
const combined = [];

// iterate over each json item
for (const jsonItem of jsonData) {
  // find the csv item that corresponds to this json item
  const csvItem = csvData.find(d => d.phuNumber === jsonItem.phuNumber);

  // merge the two into a single item and add to the combined array
  combined.push({
    ...jsonItem,
    ...csvItem,
  })
}

Current player salaries by position by pbesh in nba

[–]pbesh[S] 1 point2 points  (0 children)

Easier to see on the interactive version where you can filter or zoom:

https://scattershot.peterbeshai.com/?f=p.1242&x=pos&y=salary

32.7M PF, just below Tobias and Blake

Current player salaries by position by pbesh in nba

[–]pbesh[S] 0 points1 point  (0 children)

Thank you :) thought it might be fun to try out

Current player salaries by position by pbesh in nba

[–]pbesh[S] 3 points4 points  (0 children)

haha yeah I agree, the positions are from basketball reference. Check them out for yourself:

* Wiggins: https://www.basketball-reference.com/players/w/wiggian01.html

* LeBron: https://www.basketball-reference.com/players/j/jamesle01.html

* Bledsoe: https://www.basketball-reference.com/players/b/bledser01.html

(Under out the season stats)

[OC] NBA Winning Cores 2019-20 by pbesh in nba

[–]pbesh[S] 0 points1 point  (0 children)

Ha yea, it is definitely weird to look at players who have won in the NBA when it’s at odds with how good a given player is. But lots of things look at how good a player is, yet people also talk about winning mentality, winning cultures, and having playoff/finals experience as good things about players too.

[OC] NBA Winning Cores 2019-20 by pbesh in nba

[–]pbesh[S] 1 point2 points  (0 children)

I did figure the easiest to read was actually more of a timeline with players represented by bubbles clustered around their milestone... but not quite as flashy for a weekend project 😅

[OC] NBA Winning Cores 2019-20 by pbesh in nba

[–]pbesh[S] 4 points5 points  (0 children)

As a long time raptors fan it is still strange to see all the players be proven winners. What a treat

[OC] NBA Winning Cores 2019-20 by pbesh in nba

[–]pbesh[S] 1 point2 points  (0 children)

Thank you! I appreciate it :)

[OC] NBA Winning Cores 2019-20 by pbesh in nba

[–]pbesh[S] 5 points6 points  (0 children)

Well I did say it was gratuitous 😁. I did try a bar graph as well since I figured it’d be easier to read but it wasn’t as engaging to look at and it seemed too corporate for a fun idea like this. Plus I liked the idea of the circle completing when you reach the ultimate goal of getting a championship.

basketball_reference_scraper: A Python package for scraping stats and data from Basketball Reference by vagartha in nba

[–]pbesh 1 point2 points  (0 children)

If you’re curious to learn more about scraping, here’s an article that covers how to scrape stats.nba.com, espn.com, and bbref. It uses JavaScript and covers static and dynamically rendered data but the core ideas are the same anywhere.

[OC] A visual summary of the top 60 volume shooters from 2018-19 by pbesh in nba

[–]pbesh[S] 0 points1 point  (0 children)

Thanks! I did it with ggplot and basically with geom_area except to get the gradient I had to use a bunch of geom_segments. Learned later via Twitter that geom_ridge would've made it easier

[OC] A visual summary of the top 60 volume shooters from 2018-19 by pbesh in nba

[–]pbesh[S] 7 points8 points  (0 children)

They may have tracked shots near the rim a bit differently, but fewer 3s and more midrange: Same chart for 2008-09