Skip to content

Instantly share code, notes, and snippets.

View rveciana's full-sized avatar
🐢

Roger Veciana i Rovira rveciana

🐢
View GitHub Profile
@rveciana
rveciana / README.md
Last active December 15, 2015 01:38
D3 tutorial I: Basic map
@rveciana
rveciana / README.md
Last active December 15, 2015 01:38
D3 tutorial II: Setting projection
@rveciana
rveciana / README.md
Last active December 15, 2015 01:38
D3 tutorial III: Projection transition
@rveciana
rveciana / README.md
Last active December 15, 2015 01:39
D3 tutorial IV: Adding points
@rveciana
rveciana / README.md
Last active December 15, 2015 01:39
D3 tutorial V: Adding tooltips
@rveciana
rveciana / ANTQUAB.TTF
Last active December 15, 2015 01:39
Geoinquiets' Rotating Logo
@rveciana
rveciana / README.md
Last active December 15, 2015 08:48
Wrong way to transform a D3 projection

Actualization This behaviour has been corrected and now the example is valid, since the points are ordered the same way in both projections.

From the mailing list:

OK, this has been fixed in release 3.1.4, so you'll no longer need the work-around described in my previous email. Enjoy, and thank you for the bug report!

http://bl.ocks.org/mbostock/580de8199ea3b85f822a

@rveciana
rveciana / .block
Last active October 10, 2019 20:51
Sample data for D3js
license: cc-by-4.0
{"type":"Topology","objects":{"provincias":{"type":"GeometryCollection","bbox":[-18.161221722954284,27.637789479715888,4.329122327000227,43.791110837420135],"geometries":[{"type":"Polygon","properties":{"nombre":"Álava","idprov":"01", "seats": 4},"arcs":[[0,1,2,3,4,5,6],[7]]},{"type":"Polygon","properties":{"nombre":"Albacete","idprov":"02", "seats": 4},"arcs":[[8,9,10,11,12,13,14]]},{"type":"Polygon","properties":{"nombre":"Alicante","idprov":"03", "seats": 12},"arcs":[[15,-12,16,17]]},{"type":"Polygon","properties":{"nombre":"Almería","idprov":"04", "seats": 6},"arcs":[[18,19,20]]},{"type":"Polygon","properties":{"nombre":"Ávila","idprov":"05", "seats": 3},"arcs":[[21,22,23,24,25,26,27,28]]},{"type":"Polygon","properties":{"nombre":"Badajoz","idprov":"06", "seats": 6},"arcs":[[29,30,31,32,33,34,35,36,37]]},{"type":"MultiPolygon","properties":{"nombre":"Balears, Illes","idprov":"07", "seats": 8},"arcs":[[[38]],[[39]],[[40]],[[41]],[[42]],[[43]],[[44]],[[45]],[[46]],[[47]]]},{"type":"MultiP
@rveciana
rveciana / README.md
Last active January 24, 2023 06:02
Resizing polygons according to the population density

This example, inspired from Mike Bostock's Non-contiguous catrogram example, shows the percentage of people in Catalonia able to speak in Catalan in every comarca (data from IDESCAT).

But the Catalan population is not evenly distributed, but concentrated around Barcelona and surroundings. So comparing the region colors can lead to wrong conclusions, since they don't represent comparable amount of people.

When the Resize to population density button is pressed, the size of each coamrca is reduced according to its population density. The maximum density corresponds to the Barcelonès, which is not reduced. When the sizes are changed is much easier to compare the number of people.

The size is not reduced linearly, but applying the square root, because Catalonia is so unevenly populated that it was difficult so see anything outside Barcelona's region.

@rveciana
rveciana / README.md
Last active December 20, 2015 15:49
Filling with points according to the population density

This example, inspired in this example by Gregor Aisch, shows the percentage of people in Catalonia able to speak in Catalan in every comarca (data from IDESCAT).

But the Catalan population is not evenly distributed, but concentrated around Barcelona and surroundings. So comparing the region colours can lead to wrong conclusions, since they don't represent comparable amount of people.

So the population density is represented by the dots: The dot area represents the amount of people in each comarca