Skip to content
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

Add examples for plotting lines #493

Closed
seisman opened this issue Jun 25, 2020 · 14 comments
Closed

Add examples for plotting lines #493

seisman opened this issue Jun 25, 2020 · 14 comments
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers help wanted Helping hands are appreciated scipy-sprint Things to work on during the SciPy sprint!
Milestone

Comments

@seisman
Copy link
Member

seisman commented Jun 25, 2020

Description of the desired feature

There are already have nice tutorials for plotting data points of various sizes and colors, but no examples for plotting lines.

It would be good to add some examples showing

  • how to plot lines
  • how to specify line attributes (pen thickness, color, and pen style)
  • plot lines with various colors as determined by a CPT file

Unfortunately, PyGMT currently can't handle multi-segments data as in GMT. To plot multiple lines, we still have to call fig.plot() multiple times.

@seisman seisman added documentation Improvements or additions to documentation good first issue Good for newcomers help wanted Helping hands are appreciated labels Jun 25, 2020
@liamtoney liamtoney added the scipy-sprint Things to work on during the SciPy sprint! label Jul 6, 2020
@seisman
Copy link
Member Author

seisman commented Oct 16, 2020

#604 (comment)

Also, was just looking at the GMT.jl AGU gallery examples at https://www.generic-mapping-tools.org/GMT.jl/latest/gallery/tables/, looks like there's a lot of decorated arrows/curved line examples we can follow.

image

@weiji14 weiji14 added this to the 0.3.0 milestone Nov 22, 2020
@willschlitzer
Copy link
Contributor

I'll work on this.

@willschlitzer
Copy link
Contributor

I'm trying to figure out how to add a specific CPT, but I'm not getting it to plot on the actual line. I tried setting a specific CPT to cmap, and also tried adding "red,green" to add specific colors, but no luck.

@weiji14
Copy link
Member

weiji14 commented Dec 17, 2020

Yeah it's complicated, took me a while to figure it out recently too. Try this for inspiration:

import pygmt
import numpy as np

fig = pygmt.Figure()
fig.basemap(frame=["WSne", "af"], region=[20, 30, -10, 10])
pygmt.makecpt(cmap="batlow", series=[0, 10, 1])
x = np.arange(start=20, stop=30, step=0.2)
for zvalue in range(0, 10):
    y = zvalue * np.sin(x)
    fig.plot(x=x, y=y, cmap=True, zvalue=zvalue, pen=f"thick,+z,-")

fig.show()

sine curve with different colors

@willschlitzer
Copy link
Contributor

@weiji14 Impressive find, but that seems like a big step up in complexity from the rest of the tutorial. I've been out of geoscience for 8+ years so I don't keep up with what people want in their plots, but this seems out of place for a basic "How to plot lines" tutorial. My opinion is something like this belongs in a gallery example.

@willschlitzer
Copy link
Contributor

@seisman Are you looking to have anything else added to these line plotting examples before closing the issue? As stated above, I think the custom CPT example provided by @weiji14 may be a bit advanced for a basic tutorial.

@seisman
Copy link
Member Author

seisman commented Dec 22, 2020

@weiji14's example is pretty good and could be added to the gallery (https://www.pygmt.org/dev/gallery/index.html#lines).

@willschlitzer
Copy link
Contributor

@weiji14 Are you planning on adding your code to the gallery? I can submit a pull request for it if you're too busy.

@weiji14
Copy link
Member

weiji14 commented Dec 28, 2020

I literally came up with that in 5 minutes 😅, but yeah, feel free to adapt it into the gallery.

@willschlitzer
Copy link
Contributor

Sounds good! Didn't want to step on your toes; I'll type it up in the next day or so.

@willschlitzer
Copy link
Contributor

@seisman Are we good to close this issue now that #741 and #774 have been merged?

@seisman
Copy link
Member Author

seisman commented Jan 24, 2021

@seisman Are we good to close this issue now that #741 and #774 have been merged?

There are some lines/arrows we may want to add in the gallery. See #493 (comment)

@core-man
Copy link
Member

core-man commented Mar 15, 2021

So we still want more line examples?

  • error bar? Do error bar belong to lines?
  • mat angles
  • bezier
  • decorated
  • decorated text

Which one is on the top priority? @seisman

@seisman
Copy link
Member Author

seisman commented Apr 2, 2021

I'm closing the issue, because I feel that the Figure.plot() method is becoming too complicated and may need some re-design. I prefer NOT to add more complicated (and less used) examples (e.g., decorated text) before we have some more discussions about Figure.plot().

@seisman seisman closed this as completed Apr 2, 2021
@seisman seisman unpinned this issue Apr 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers help wanted Helping hands are appreciated scipy-sprint Things to work on during the SciPy sprint!
Projects
None yet
Development

No branches or pull requests

5 participants