Skip to content

Commit bb4d496

Browse files
committed
Use position="MC" to put text in the subplot tutorial and silence pylint
1 parent 1d937b5 commit bb4d496

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

.pylintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ function-naming-style=snake_case
441441
good-names=i,
442442
j,
443443
k,
444+
ax,
444445
ex,
445446
Run,
446447
_,

examples/tutorials/subplots.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
j = index % axs.shape[1] # column
4747
fig.sca(ax=axs[i, j]) # sets the current Axes
4848
fig.text(
49-
x=0.5, y=0.5, text=f"index: {index}, row: {i}, col: {j}", region=[0, 1, 0, 1]
49+
position="MC", text=f"index: {index}, row: {i}, col: {j}", region=[0, 1, 0, 1]
5050
)
5151
fig.end_subplot()
5252
fig.show()

pygmt/figure.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,10 +396,11 @@ def __init__(self, nrows, ncols, figsize, **kwargs):
396396
self._activate_figure()
397397
self.begin_subplot(row=nrows, col=ncols, figsize=figsize, **kwargs)
398398

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

416+
@staticmethod
415417
@fmt_docstring
416418
@use_alias(F="dimensions")
417-
def sca(self, ax=None, **kwargs):
419+
def sca(ax=None, **kwargs):
418420
"""
419421
Set the current Axes instance to *ax*.
420422
@@ -432,9 +434,10 @@ def sca(self, ax=None, **kwargs):
432434
with Session() as lib:
433435
lib.call_module(module="subplot", args=arg_str)
434436

437+
@staticmethod
435438
@fmt_docstring
436439
@use_alias(V="verbose")
437-
def end_subplot(self, **kwargs):
440+
def end_subplot(**kwargs):
438441
"""
439442
This command finalizes the current subplot, including any placement
440443
of tags, and updates the gmt.history to reflect the dimensions and

pygmt/pygmtplot.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
"""
2+
High level functions for making subplots.
3+
"""
14
import numpy as np
25

36
from .figure import SubPlot

0 commit comments

Comments
 (0)