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 plotting lines tutorial #741

Merged
merged 10 commits into from
Dec 18, 2020

Conversation

willschlitzer
Copy link
Contributor

Adding a tutorial to show how to plot lines, as discussed in #493.

@seisman seisman added the documentation Improvements or additions to documentation label Dec 17, 2020
@seisman seisman added this to the 0.3.0 milestone Dec 17, 2020
doc/index.rst Outdated Show resolved Hide resolved
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
@willschlitzer
Copy link
Contributor Author

Would a section on plotting points belong in this tutorial, or should that be a separate tutorial?

@seisman
Copy link
Member

seisman commented Dec 17, 2020

Would a section on plotting points belong in this tutorial, or should that be a separate tutorial?

There is already a tutorial about plotting points (https://www.pygmt.org/dev/tutorials/plot.html).

@willschlitzer
Copy link
Contributor Author

Must have missed that; my apologies!

examples/tutorials/line-plot.py Outdated Show resolved Hide resolved
Comment on lines 68 to 127
# In the example below, the pen width is set to ``"5p"``, and with *black* as the
# default color and *solid* as the default style.

fig = pygmt.Figure()
fig.plot(
region=[0, 10, 0, 10],
projection="X25c/20c",
frame="a",
x=[1, 8],
y=[3, 9],
pen="5p",
)
fig.show()

########################################################################################
# The line color can be set and is added after the line width to the ``pen`` argument.
# In the example below, the line color is set to "red".

fig = pygmt.Figure()
fig.plot(
region=[0, 10, 0, 10],
projection="X25c/20c",
frame="a",
x=[1, 8],
y=[3, 9],
pen="5p,red",
)
fig.show()

########################################################################################
# The line style can be set and is added after the line width or color to the
# ``pen`` argument. In the example below, the line color is set to *dot dot dash*, and
# the default color *black* is used.

fig = pygmt.Figure()
fig.plot(
region=[0, 10, 0, 10],
projection="X25c/20c",
frame="a",
x=[1, 8],
y=[3, 9],
pen="5p,..-",
)
fig.show()

########################################################################################
# The line width, color, and style can all be set in the same ``pen`` argument. In the
# example below, the line width is set to *7p*, the color is set to *green*, and the
# line style is *dash dot dash*.

fig = pygmt.Figure()
fig.plot(
region=[0, 10, 0, 10],
projection="X25c/20c",
frame="a",
x=[1, 8],
y=[3, 9],
pen="7p,green,-.-",
)
fig.show()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking whether it's better to merge these 4 figures into a single figure, i.e., showing 4 lines with different line properties. It would save much space and also easier for people to compare the different pen settings.

We also have a gallery example for different line styles. I think you can add a link to that example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a conscious choice on my part, since the gallery already shows the different pen settings side by side. My thought process is that the tutorial instead takes the user through the steps of plotting a line, and shows how they can set one or more properties.

I'm happy to change it if you think its the smarter move, but I do like the way it's currently displayed.

Also, is there a good way to link to other PyGMT pages similar to using gmt-docs?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. let's keep it this way.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, is there a good way to link to other PyGMT pages similar to using gmt-docs?

You can use to link to that file:

:doc:`/gallery/line/linestyles`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I wasn't having any luck with trying variations of pygmt-docs

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html

You may read this if you want to know more about cross-references in ReST language.

doc/index.rst Outdated Show resolved Hide resolved
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
@seisman seisman merged commit f1a10df into GenericMappingTools:master Dec 18, 2020
@willschlitzer willschlitzer deleted the plot-line-tutorial branch December 18, 2020 08:14
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants