Package: nextplot
nextplotTools for plotting routes and clusters from JSONInstallationpipinstallnextplotUsageIf the installation succeeded, you should be able to invoke the following:nextplot--helpFurthermore, use therouteandclustercommands for the respective
plotting type. Find an overview of the arguments for the specific mode by
invokingnextplot route --helpandnextplot cluster --help.Above shows some information about how to use the script. Below presents some
further information for running the script using route plotting as an example.There are basically two options of running the script. Either feed the JSON to
STDIN of the script like so:catexamples/data/kyoto-route.json|nextplotroute\--jpath_route"vehicles[*].route"\--jpath_x"position.lon"\--jpath_y"position.lat"Or supply a path to the.jsonfile like so:nextplotroute\--input_routeexamples/data/kyoto-route.json\--jpath_route"vehicles[*].route"\--jpath_x"position.lon"\--jpath_y"position.lat"Both approaches will create a.pngplot image and if possible (valid lon/lat
coordinates given) an interactive.htmlplot file. The filenames will beplot.[png,html]for the first option, based on the input filename for the
second option and customized ones if--output_imageand/or--output_mapare
specified.The input file is expected to have some JSON array of positions which can be
addressed using the notation described here:https://goessner.net/articles/JsonPath/.
The path to the positions can be modified via the--jpath_routeparameter.
For example, if your input file stores the locations like shown below, the path"vehicles[*].route"will extract them. As you can see, the
path first goes through thevehicles. Next,[*]denotes that a list of
vehicles is expected, which in turn results in a list of routes. Finally,.routepoints to the exact location of the route object per vehicle. The--jpath_xand--jpath_yparameters are used to extract the longitude and
latitude values from the stop objects atposition.lonandposition.lat.{
    "vehicles": [
        // ...
        {
            "id": "v1",
            "route": [
                {
                    "id": "v1-start",
                    "position": { "lon": 135.73723, "lat": 35.04381 }
                },
                {
                    "id": "Kinkaku-ji",
                    "position": { "lon": 135.728898, "lat": 35.039705 }
                },
                {
                    "id": "Nijō Castle",
                    "position": { "lon": 135.748134, "lat": 35.014239 }
                },
                {
                    "id": "Arashiyama Bamboo Forest",
                    "position": { "lon": 135.672009, "lat": 35.017209 }
                }
            ]
        }
        // ...
    ]
}Further examplesA more detailed introduction and a plot gallery can be foundhere.PreviewPreviewrouteplot (screenshot of .html-file, cartodbdark_matter selected):Another previewrouteplot (screenshot of .html-file, cartodbdark_matter selected):Previewclusterplot (screenshot of .html-file, cartodbdark_matter selected):Auto-completionAuto-completion (usingtab) is supported viaargcomplete. To enable it, install the package:pipinstallargcompleteThen, add the following line to your~/.bashrc:eval"$(register-python-argcompletenextplot)"Development setupInstall development dependenciespipinstall-rrequirements-dev.txtTestsTests are located intests/and can be run viapython -m pytest. Update test
expectations (golden files) by runningUPDATE=1 python test_cli.pyfrom the
test directory.