Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions pygmt/base_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,8 @@ def plot(self, x=None, y=None, data=None, sizes=None, direction=None, **kwargs):

Parameters
----------
x, y : 1d arrays
Arrays of x and y coordinates of the data points.
x, y : float or 1d arrays
The x and y coordinates, or arrays of x and y coordinates of the data points
data : str or 2d array
Either a data file name or a 2d numpy array with the tabular data.
Use option *columns* (i) to choose which columns are x, y, color,
Expand Down Expand Up @@ -426,7 +426,9 @@ def plot(self, x=None, y=None, data=None, sizes=None, direction=None, **kwargs):
elif kind == "matrix":
file_context = lib.virtualfile_from_matrix(data)
elif kind == "vectors":
file_context = lib.virtualfile_from_vectors(x, y, *extra_arrays)
file_context = lib.virtualfile_from_vectors(
np.atleast_1d(x), np.atleast_1d(y), *extra_arrays
)

with file_context as fname:
arg_str = " ".join([fname, build_arg_string(kwargs)])
Expand Down
Binary file added pygmt/tests/baseline/test_plot_scalar_xy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions pygmt/tests/test_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,3 +256,14 @@ def test_plot_vectors():
frame="af",
)
return fig


@pytest.mark.mpl_image_compare
def test_plot_scalar_xy():
"Plot symbols given scalar x, y coordinates"
fig = Figure()
fig.basemap(region=[-2, 2, -2, 2], frame=True)
fig.plot(x=-1.5, y=1.5, style="c1c")
fig.plot(x=0, y=0, style="t1c")
fig.plot(x=1.5, y=-1.5, style="s1c")
return fig