Skip to content

Add an example for double Y-axis graph #1009

Closed

Description

@seisman

image

Figure from https://www.originlab.com/doc/Origin-Help/Double-Y-Graph.

This kind of base maps are commonly seen. In GMT or PyGMT, we need to make two base maps (with same x limits but different Y limits) and plot data points separately.

This is a good gallery example, but I'm not sure which category it falls in.

Activity

  1. added
    good first issue
    documentation
    on Mar 5, 2021
  2. core-man commented on Mar 7, 2021

    @core-man
    Member

    A quick demo:

    import pygmt
    import numpy as np
    
    x = np.linspace(1.0, 9.0, num=9)
    y = x
    z = x**2 + 110
    
    fig = pygmt.Figure()
    fig.plot(
        region=[0, 10, 0, 10],
        projection="X5c/5c",
        frame=["WS", "af", "x+lX", "y+lY1"],
        x=x,
        y=y,
        style="c0.2c",
        color="blue",
        label="Y1",
    )
    fig.plot(
        region=[0, 10, 0, 200],
        frame=["Et", "af", "y+lY2"],
        x=x,
        y=z,
        style="s0.3c",
        color="red",
        label="Y2",
    )
    fig.legend(position="JTL+jTL+o0.2c", box=True)
    fig.show()

    Screenshot from 2021-03-07 21-57-45

  3. added this to the 0.3.1 milestone on Mar 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationgood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions