Conversation
|
/format |
|
I feel the logo definition should be separated into a standalone method, similar to the method to plot the GMT logo. This would allow to plot the PyGMT logo by calling something like |
|
ruff v0.10.0 was released 2 hours ago causing the newly falling code style checks. |
@yvonnefroehlich You can follow the steps below:
Then, you should be able to call |
Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com>
Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com>
Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
weiji14
left a comment
There was a problem hiding this comment.
Some suggestions to add an inline example, and allow configuring the width/height. Still need to finalize the docstring (copy over from fig.image?).
| color | ||
| Set to ``True`` to use colors referring to Python (blue and yellow) and GMT | ||
| (red) [Default]. For ``False``, the logo is drawn in black and white. | ||
| """ |
There was a problem hiding this comment.
Add an inline example
| """ | |
| Examples | |
| -------- | |
| >>> import pygmt | |
| >>> fig = pygmt.Figure() | |
| >>> fig.basemap(region=[-90, -70, 0, 20], projection="M10c", frame=True) | |
| >>> fig.pygmtlogo( | |
| ... shape="circle", | |
| ... theme="light", | |
| ... wordmark="horizontal", | |
| ... color=True, | |
| ... position="BR", | |
| ... height="1c", | |
| ... ) | |
| >>> fig.show() | |
| """ |
|
|
||
| def create_logo( # noqa: PLR0915 |
There was a problem hiding this comment.
Add __doctest_skip__ for inline example, and make _create_logo private function.
| def create_logo( # noqa: PLR0915 | |
| __doctest_skip__ = ["pygmtlogo"] | |
| def _create_logo( # noqa: PLR0915 |
| # ----------------------------------------------------------------------------- | ||
| # Create logo file | ||
| # ----------------------------------------------------------------------------- | ||
| fig_name_logo = create_logo( |
There was a problem hiding this comment.
| fig_name_logo = create_logo( | |
| fig_name_logo = _create_logo( |
| theme="light", | ||
| shape="circle", | ||
| wordmark=True, | ||
| position=None, # -> Use position parameter of Figure.image |
There was a problem hiding this comment.
Allow configuring width/height also
| position=None, # -> Use position parameter of Figure.image | |
| position=None, # -> Use position parameter of Figure.image | |
| width=None, # -> Use width parameter of Figure.image | |
| height=None, # -> Use height parameter of Figure.image |
| # ----------------------------------------------------------------------------- | ||
| self.image( | ||
| imagefile=f"{fig_name_logo}.eps", | ||
| position=position, |
There was a problem hiding this comment.
| position=position, | |
| position=position, | |
| width=width, | |
| height=height, |
Description of proposed changes
Related to #1404 (comment), create the PyGMT logo in Python with PyGMT.
Figure.pygmtlogoorFigure.logo_pygmtas part of theFigureclass or addition to the methodFigure.logo(which plots the GMT logo)Preview:
Related to
TODO:
shape="circle" | "hexagon"orhex=False | TrueFigure.image)Figureclass or addition toFigure.logo.Issues:
Figureobjects using the saved eps files. Maybe this is not easy to handle when converting to a method of theFigureclasse.Reminders
make formatandmake checkto make sure the code follows the style guide.doc/api/index.rst.Slash Commands
You can write slash commands (
/command) in the first line of a comment to performspecific operations. Supported slash command is:
/format: automatically format and lint the code