Note
Go to the end to download the full example code.
Add paleogeography mask in scatter data plot#
This example shows how to add paleogeography mask according to input age

/home/docs/checkouts/readthedocs.org/user_builds/cgeniepy/envs/latest/lib/python3.12/site-packages/cgeniepy/plot.py:636: UserWarning: kind is not used for map plotting
warnings.warn("kind is not used for map plotting")
<matplotlib.collections.PathCollection object at 0x742311173d10>
from cgeniepy.table import ScatterData
import pandas as pd
import numpy as np
# Generate random data
np.random.seed(1239124) # Set seed for reproducibility
# Create random latitude, longitude, and variable values
random_data = pd.DataFrame({
'lat': np.random.uniform(-90, 90, 100),
'lon': np.random.uniform(-180, 180, 100),
'dummy_var': np.random.random(100) * 100
})
# Convert to ScatterData object
random_data = ScatterData(random_data)
# Set MultiIndex for the data
random_data.set_index(['lat', 'lon'])
# Plot with specified parameters
random_data.plot(var='dummy_var', edgecolor='k', mask_age=100)
Total running time of the script: (0 minutes 6.969 seconds)