|
From: Ethan A M. <me...@uw...> - 2020-03-03 23:40:16
|
On Tuesday, 3 March 2020 14:30:40 PST Allin Cottrell wrote:
> This question has been posed before (a few years back) but I'm
> hoping someone may be able to point me to the state-of-the-art,
> if there is such.
>
> I'd like to be able to produce via gnuplot a map of (for example)
> the USA showing the states colored by median income, or PM2.5
> particulate emissions, or whatever.
>
> I understand that the starting point would be a suitable US states
> shapefile (I know where I can get that), which would have to be
> translated to a format (resembling world.dat, I suppose) that can be
> understood by gnuplot. I have some notion of how that might be done.
>
> The next issue would be to get gnuplot to colorize specified areas
> of the map according to the values of some additional data.
> Unfortunately I have little notion of how to do that.
The development version of gnuplot supports
splot <data> with polygons
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
gnuplot> help polygons
splot DATA {using x:y:z} with polygons
{fillstyle <fillstyle spec>}
{fillcolor <colorspec>}
`splot with polygons` uses pm3d to render individual triangles, quadrangles,
and larger polygons in 3D. These may be facets of a 3D surface or isolated
shapes. The code assumes that the vertices lie in a plane.
Vertices defining individual polygons are read from successive records of the
input file. A blank line separates one polygon from the next.
The fill style and color may be specified in the splot command, otherwise the
global fillstyle from `set style fill` is used. Due to limitations in the
pm3d code, a single border line style from `set pm3d border` is applied to all
polygons. This restriction may be removed in a later gnuplot version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
This plot mode will be in version 5.4 (release candidate coming soonish).
Meanwhile you can build from the source for either branch:
master
branch-5-4-stable
I realize you don't need 3D, but plotting in projection is easy, and you even
have the option to map it onto a globe :-)
I am uncertain whether there is adequate flexibility to use the 3rd coordinate
as a color flag. If there isn't, there probably should be so let me know and
I'll work on it.
Ethan
|