Skip to content

Commit

Permalink
Use position="MC" to put text in the subplot tutorial and silence pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
weiji14 committed Oct 15, 2020
1 parent 1d937b5 commit bb4d496
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ function-naming-style=snake_case
good-names=i,
j,
k,
ax,
ex,
Run,
_,
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorials/subplots.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
j = index % axs.shape[1] # column
fig.sca(ax=axs[i, j]) # sets the current Axes
fig.text(
x=0.5, y=0.5, text=f"index: {index}, row: {i}, col: {j}", region=[0, 1, 0, 1]
position="MC", text=f"index: {index}, row: {i}, col: {j}", region=[0, 1, 0, 1]
)
fig.end_subplot()
fig.show()
Expand Down
9 changes: 6 additions & 3 deletions pygmt/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,10 +396,11 @@ def __init__(self, nrows, ncols, figsize, **kwargs):
self._activate_figure()
self.begin_subplot(row=nrows, col=ncols, figsize=figsize, **kwargs)

@staticmethod
@fmt_docstring
@use_alias(Ff="figsize", B="frame")
@kwargs_to_strings(Ff="sequence")
def begin_subplot(self, row=None, col=None, **kwargs):
def begin_subplot(row=None, col=None, **kwargs):
"""
The begin directive of subplot defines the layout of the entire
multi-panel illustration. Several options are available to specify
Expand All @@ -412,9 +413,10 @@ def begin_subplot(self, row=None, col=None, **kwargs):
with Session() as lib:
lib.call_module(module="subplot", args=arg_str)

@staticmethod
@fmt_docstring
@use_alias(F="dimensions")
def sca(self, ax=None, **kwargs):
def sca(ax=None, **kwargs):
"""
Set the current Axes instance to *ax*.
Expand All @@ -432,9 +434,10 @@ def sca(self, ax=None, **kwargs):
with Session() as lib:
lib.call_module(module="subplot", args=arg_str)

@staticmethod
@fmt_docstring
@use_alias(V="verbose")
def end_subplot(self, **kwargs):
def end_subplot(**kwargs):
"""
This command finalizes the current subplot, including any placement
of tags, and updates the gmt.history to reflect the dimensions and
Expand Down
3 changes: 3 additions & 0 deletions pygmt/pygmtplot.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
"""
High level functions for making subplots.
"""
import numpy as np

from .figure import SubPlot
Expand Down

0 comments on commit bb4d496

Please sign in to comment.