See cartomisc::gplot_data for details.