-
Notifications
You must be signed in to change notification settings - Fork 214
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
Some vectors lost head #3282
Comments
👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible. You might also want to take a look at our contributing guidelines and code of conduct. |
Hello @sungho91, As we do not have your input data, we cannot run your script. However, I think the vectors within the orange-dashed box are drawn without heads because the vector length is too short relatively to the size of the heads. Please find below a general code example showing this: import numpy as np
import pygmt
x = np.linspace(0.2, 0.2, 6) # x vector coordinates
y = np.linspace(-2, 2, 6) # y vector coordinates
direction = np.zeros(x.shape) # direction of vectors
length = np.linspace(0.1, 1.4, 6) # length of vectors
fig = pygmt.Figure()
fig.basemap(region=[0, 10, -2.5, 2.5], projection="X5c/3c", frame=0)
# Plot Cartesian vectors with different lengths and diffent head sizes
fig.plot(x=x, y=y, style="v0.4c+e", direction=[direction, length])
fig.plot(x=x+3.3, y=y, style="v0.2c+e", direction=[direction, length])
fig.plot(x=x+6.6, y=y, style="v0.1c+e", direction=[direction, length])
fig.show() |
Thank you for your comment. I've attached my files to this. |
I think you need to use |
I just modified my code example to compare the results without (black) and with (red) using # Modified from https://www.pygmt.org/dev/gallery/lines/vector_styles.html#sphx-glr-gallery-lines-vector-styles-py
# Last access 2024/06/03
import numpy as np
import pygmt
x = np.linspace(0.4, 0.4, 4) # x vector coordinates
y = np.linspace(-1, 1, 4) # y vector coordinates
direction = np.zeros(x.shape) # direction of vectors
length = np.linspace(0.1, 0.5, 4) # length of vectors
fig = pygmt.Figure()
fig.basemap(region=[0, 3, -1.5, 1.5], projection="X3c/2c", frame=0)
for keep_head in ["", "+n"]:
match keep_head:
case "": pen = "0.7p,black"
case "+n": pen = "0.2p,red"
# Plot Cartesian vectors with different lengths and diffent head sizes
fig.plot(x=x, y=y, style=f"v0.4c+e{keep_head}", pen=pen, direction=[direction, length])
fig.plot(x=x+1, y=y, style=f"v0.2c+e{keep_head}", pen=pen, direction=[direction, length])
fig.plot(x=x+2, y=y, style=f"v0.1c+e{keep_head}", pen=pen, direction=[direction, length])
fig.show(dpi=720) |
Description of the problem
Hi
All vectors should have a head but some of them don't have (orange-dotted box in att.).
How can I fix them?
Best,
Sungho
Minimal Complete Verifiable Example
Full error message
No response
System information
The text was updated successfully, but these errors were encountered: