Skip to content

Commit

Permalink
Add a gallery example for varying transparent points (#654)
Browse files Browse the repository at this point in the history
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
  • Loading branch information
seisman and weiji14 authored Oct 20, 2020
1 parent e230308 commit 060b723
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions examples/gallery/plot/points-transparency.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""
Points with varying transparency
--------------------------------
Points can be plotted with different transparency levels by passing in an array to the
``transparency`` argument of :meth:`pygmt.Figure.plot`.
"""

import numpy as np
import pygmt

# prepare the input x and y data
x = np.arange(0, 105, 5)
y = np.ones(x.size)
# transparency level in percentage from 0 (i.e., opaque) to 100
transparency = x

fig = pygmt.Figure()
fig.basemap(
region=[-5, 105, 0, 2],
frame=['xaf+l"Transparency level"+u%', "WSrt"],
projection="X15c/6c",
)
fig.plot(x=x, y=y, style="c0.6c", color="blue", pen="1p,red", transparency=transparency)
fig.show()

0 comments on commit 060b723

Please sign in to comment.