Conversation
|
@leouieda Can you help review it? |
pygmt/figure.py
Outdated
| img = Image(data=png, width=width) | ||
| return img | ||
|
|
||
| def shift_origin(self, xshift=None, yshift=None): # pylint: disable=no-self-use |
There was a problem hiding this comment.
| def shift_origin(self, xshift=None, yshift=None): # pylint: disable=no-self-use | |
| def shift_origin(self, xshift=None, yshift=None): |
@seisman you still need to call self._preprocess() to make sure we're plotting to the right figure. This is not a great design, granted. But the only other I can think of for calling the figure module automatically is through a metaclass, which I'm not eager to do.
pygmt/figure.py
Outdated
|
|
||
| def shift_origin(self, xshift=None, yshift=None): # pylint: disable=no-self-use | ||
| """ | ||
| Shift origins in x and/or y directions. |
There was a problem hiding this comment.
Some more information here would be great.
leouieda
left a comment
There was a problem hiding this comment.
Thanks @seisman! Could you also add a gallery plot that uses this method? Maybe plotting an inset or something. It would be great to use it in this tutorial instead of X: https://github.com/GenericMappingTools/pygmt/blob/master/examples/tutorials/coastlines.py#L63
| to the fixed lower left corner of the page, or prepend **r** [Default] to | ||
| move the origin relative to its current location. | ||
|
|
||
| Detailed usage at http://gmt.soest.hawaii.edu/doc/latest/GMT_Docs.html#plot-positioning-and-layout-the-x-y-options |
There was a problem hiding this comment.
What's the best way to reference the official GMT documentation?
There was a problem hiding this comment.
I still don't know of a good way to do this yet. I'm open to suggestions. It would be best to have this as a variable somewhere and input into the docstring somehow.
There was a problem hiding this comment.
@leouieda Can we rename the gmt_module_docs decorator to something like gmt_docs, which supports following conversions:
{gmt_docs basemap} => http://gmt.soest.hawaii.edu/doc/latest/basemap.html
{gmt_docs gmt xy-full} => http://gmt.soest.hawaii.edu/doc/latest/gmt.html#xy-full
There was a problem hiding this comment.
I would actually like to get rid of most of those decorators in favor of something simpler to maintain. But I don't think there is a good way to format the docstring without using a decorator. We could certainly add that functionality. But we should be using the https://www.generic-mapping-tools.org/gmt/latest/ domain now.
There was a problem hiding this comment.
How about putting the raw links in the docstrings, without using a decorator or any substitutions? If someday the GMT documentation site changes, it's still easy to update all the links.
I have no idea what to add in the gallery. We should use the |
|
@seisman you're right about the inset. The usage in the tutorial is good as that is the intended use of the method. Thanks! |
Description of proposed changes
Add
Figure.shift_origin()to shift plot origins.Fixes #267.
Reminders
make formatandmake checkto make sure the code follows the style guide.doc/api/index.rst.