-
Notifications
You must be signed in to change notification settings - Fork 220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pass string-type x and y to text or other plotting functions #633
Comments
I have a similar issue when passing pandas columns to Full code that generated the error The script works with PyGMT v0.1.2, but fails with PyGMT v0.2.0 (and master). import pandas as pd
import pygmt
data = pd.read_csv("input.txt", names=("id", "longitude", "latitude"), delim_whitespace=True)
fig = pygmt.Figure()
fig.basemap(region=[0, 100, 0, 100], projection='X10c', frame=True)
fig.plot(x=data.longitude, y=data.latitude, style='c0.2c', color='red')
fig.text(x=data.longitude, y=data.latitude, text=data.id, font='16p,red', offset='0.25c')
fig.show() Full error message
|
This is because we refactored
Probably not, unless someone uses Degrees/Minutes/Seconds format (does GMT support this)? Our documentation for `text currently says: Lines 1100 to 1102 in 94b23a2
So we're somewhat hinting that only numerical types are used. We could try to support string types (that are actually numbers) but that will take a bit of work. |
That's a good point. GMT CLI supports different input format for geographic coordinates. For example:
|
Description of the problem
PR #480 mention that, x and y of the
text()
function can accept int, float or str. It's true for PyGMT v0.1.2, but since PyGMT v0.2.0, it's no longer possible to pass string-type x or y.I haven't looked into the codes to check why it works for v0.1.2. The question is, do we want to accept string-type x and y coordinates?
Full code that generated the error
Full error message
System information
Please paste the output of
python -c "import pygmt; pygmt.show_versions()"
:The text was updated successfully, but these errors were encountered: