-
Notifications
You must be signed in to change notification settings - Fork 224
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
Figure.plot fails to plot lines correctly #255
Comments
I modified the code above to plot symbols instead lines:
The symbols are correctly plotted. It seems that the input passed to |
Using
|
@leouieda I think we should make this issue a high priority, since plot lines is the most used feature. I tried to find the cause but failed and got totally confused how pygmt sends virtual file to gmt. |
I agree. I'm finishing #269 and I'll get on this. The whole low-level wrapper needs a refactor as well and some documentation. I wonder if GMT is looking for different things in the given data depending on what kind of plot it is. |
The problem is that the object in x are floats, and those in y are integers. I.e. this works: import pygmt
fig = pygmt.Figure()
fig.basemap(J="X8c/8c", R="-10/10/0/10", B=True)
fig.plot(x=[0.0, 0.0], y=[0.0, 10.0], W="1p,gray,-")
fig.plot(x=[5.0, 5.0], y=[2.0, 8.0], W="1p,gray,-")
fig.plot(x=[3.0, 8.0], y=[0.0, 10.0], W="1p,gray,-")
fig.show(method="external")
|
The issue is caused by a GMT bug. See GenericMappingTools/gmt#3330 for the detailed bug report. The bug was already fixed in PR GenericMappingTools/gmt#3331 and the script above should work with the upcoming GMT 6.1.0 release. I added an upstream label to this issue and keep the issue opening, as I don't think we can/should do any hacking on the PyGMT side. Since plot() is one of the most commonly used functions, I propose that, when GMT 6.1.0 is released, we should:
|
I just hit this problem when plotting some lines, it took me a while to figure out why I had strange horizontal lines (because the bug example above was plotting vertical lines)! Turns out using x of dtype 'float32' and y of dtype 'float64' messes things up too, we should add test cases for all sorts of mixed type combinations (e.g. int32/float32, float32/float64, etc) once we start using GMT 6.1. This is how it should look like: |
Description of the problem
Figure.plot() doesn't plot simple lines correctly.
Full code that generated the error
Output plot
Only the first line is correct. The other two lines are wrong.
System information
conda list
belowThe text was updated successfully, but these errors were encountered: