I have an Excel spreadsheet with the amount of ppl. living in each state of the USA, and I want to graph that in a SVG-map with colors.
Something like this: https://commons.wikimedia.org/wiki/File:USA_states_population_density_map.PNG
It is of course possible to manually assign colors to the states according to population size, but is it possible to automate this process in some way?
big data and Inkscape. Automation?
Re: big data and Inkscape. Automation?
I would guess that probably a script could be written to do that. But I don't know how to write scripts. I don't know of any automatic way to do it with inkscape. But it seems there are extensions around, which aren't widely known. People make for themselves and don't bother to let the wider community know about it. So maybe there might be an extension somewhere that could do it. You could only search, I guess.
Basics - Help menu > Tutorials
Manual - Inkscape: Guide to a Vector Drawing Program
Inkscape Community - Inkscape FAQ - Gallery
Inkscape for Cutting Design
Manual - Inkscape: Guide to a Vector Drawing Program
Inkscape Community - Inkscape FAQ - Gallery
Inkscape for Cutting Design
-
- Posts: 2344
- Joined: Sun Apr 14, 2013 12:04 pm
- Location: Michigan, USA
Re: big data and Inkscape. Automation?
For fifty states, it is probably not worth the effort to automate, unless the image needs to be frequently updated.
Have a nice day.
I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1
The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/
I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1
The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/
Re: big data and Inkscape. Automation?
Well, in this particular case you could do it with a VBA script in Excel I guess... You would set the name of the state as the ID for each object in your SVG and then the VBA script would read the file, parse the XML, and modify the color attribute for the object whose ID you get from each of the cells you want...
But like tylerdurden said, for just a small amount of data it's just not worth it, unless you have to do a lot more maps with the same map but with different values for each state.
But like tylerdurden said, for just a small amount of data it's just not worth it, unless you have to do a lot more maps with the same map but with different values for each state.
Re: big data and Inkscape. Automation?
It is not just this problem of course. It is worthwhile for the future to find out more about this. In more complex drawings this could really helpful.
Thank you for your anwers.
Thank you for your anwers.
Re: big data and Inkscape. Automation?
Yes, some sort of generation by code would be lovely. But the truth is that such I thing should be done by 3rd party libraries in programing languages. Many of them would probably have an SVG library, it will not generate Inkscape SVGs but plain ones.