Double free or corruption (out) when fig.plot is called?

Hi everyone!

pygmt is version 0.8.0.

I’m drawing a figure with gridimage, coast, plot and grdcontour. All except plot work and produce the expected image, but if I uncomment the plot line, python crashes reporting double free or corruption (out) .

style = "v0.1c+e,white"
fig.plot(x = test[:,1], y = test[:,0], style = style, pen = "1p,white", direction=[test[:,2], test[:,3]])

The second line is the problematic one, size of test variable is equal for x,y, and direction.

Any tips?

Thanks!

Hello @ljeonjko,

it seems like you want to plot vectors. Can you please provide the content of your variable test? Currently, it is difficult to infer what is going wrong in detail. To make it easier for people to help you, please post a complete code example. Thanks! :slightly_smiling_face:.

Can you please try:

fig.plot(
    x=test[:,1],
    y=test[:,0],
    style=style,
    pen="1p,white",
    direction=[ [test[:,2]], [test[:,3]] ],   # please note the additional square brackets
)

Maybe the PyGMT tutorial on plotting vectors can also help you https://www.pygmt.org/dev/tutorials/advanced/vectors.html.

Hi! Thanks for the tip, but it was not it. Original code works on another system, so it’s probably system related. Thank you anyways :smiley:

Sometimes, a PyGMT script may work on macOS/Linux but crash (double free or corruption (out)) on Windows. It would be good if you can share your full script, so that we can try to see if it’s reproducible and then find the cause.