Color and size of symbol based in "z" value

Hello!

I have a bit of experience with GMT and a few days ago I started working with PyGMT

I appreciate any help to solve the following question: I have a file with three columns: latitude, longitude and Bouguer anomalies. I was able to make a map where the color of the symbol is a function of the range of the Bouguer anomalies, but I want to make a map where the size and color of the symbol are a function of that range

I searched among the examples and in the forum, but I did not find any guide.

I really appreciate any help on how I could do what I’m looking for in PyGMT

Thank you

Cheers

1 Like

Hmm, so by ‘function’, do you mean a linear function or a non-linear one? What are the min and max values of your range, and do you want the size to change in constant steps or on a different scale (e.g. log scale)?

For the size, you can set it using fig.plot(..., size=?), where the size parameter accepts an array of values (this can be your Bouguer anomaly column of data). Refer to https://www.pygmt.org/v0.6.1/api/generated/pygmt.Figure.plot.html

For colors, the function you’ll definitely need is pygmt.makecpt at https://www.pygmt.org/v0.6.1/api/generated/pygmt.makecpt.html.

For inspiration, see these examples:

Those examples would require you to load your lon/lat/anomaly data into a pandas.DataFrame first. Maybe share a small sample of your data (e.g. 5 rows) so we can advise on how to plot it.

Alternatively, if you can get a working GMT bash script, we can translate it to PyGMT for you :grinning:

Hello weiji14

Thanks for the reply. Apologies if my previous message was not clear.

What I want to do in PyGMT is a figure like the following.

In this case, the size of the point is given by the values ​​of the variable and the color by a category that I defined.

The figure that I managed to do in PyGMT is the following, but all the points have the same size:

Captura de pantalla 2022-06-06 165955

I attach the code I use and some of the data

I will study the information of the links

Thanks for the help

Regards

Code.txt (886 Bytes)

ExampleData.txt (177 Bytes)