Is there a way to use a custom map in a geoplot? #145
-
I would like to use my own vector map of the Earth in a geoplot, is this possible, and if so, how? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The geographic functions usually call So if you have your own map, all you need to do is bypass these points and call plot with your own points instead. Something like: auto [x, y] = your_own_vector_map();
line_handle a = ax->plot(x, y);
a->tag("map");
color_array land_color = {0, 0.9294, 0.9294, 0.9294};
a->color(land_color);
a->fill(true);
color_array bg = {0, 0.7882, 0.7882, 0.7882};
ax->color(bg);
ax->x_axis().geographic(true);
ax->x_axis().tick_label_format("%Dº%E");
ax->x_axis().label("Longitude");
ax->y_axis().geographic(true);
ax->y_axis().tick_label_format("%Dº%N");
ax->y_axis().label("Latitude"); The geolimits function will later crop unused data points from the map. |
Beta Was this translation helpful? Give feedback.
The geographic functions usually call
geoplot()
, which ensures the figure has a map in it, or creates a map otherwise by calling theworld_map_110m()
which returns the map points. Everything else is just calling the line plot functions to draw the map.So if you have your own map, all you need to do is bypass these points and call plot with your own points instead. Something like: