Skip to content

Commit f7cedcf

Browse files
authored
Let viz(StepRange, vector) work too like plot(...) does. (#1688)
* Test/demo file for the whittaker smoothing function. * Let viz(StepRange, vec) work too.
1 parent 932f0e0 commit f7cedcf

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/imshow.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,12 @@ function imshow(arg1, x::AbstractVector{Float64}=Float64[], y::AbstractVector{Fl
6565
elseif (isa(arg1, Array{UInt8}) || isa(arg1, Array{UInt16,3}))
6666
Gi = mat2img(arg1; kw...)
6767
call_img = true
68-
elseif (isa(arg1, GDtype) || isa(arg1, GMTfv) || isa(arg1, Vector{GMTfv}) || (isa(arg1, VecOrMat{<:Real}) && size(arg1,2) <= 4) || (isa(arg1, Gdal.AbstractDataset) || isa(arg1, Gdal.AbstractGeometry)))
68+
elseif (isa(arg1, GDtype) || isa(arg1, GMTfv) || isa(arg1, Vector{GMTfv}) || (isa(arg1, AbstractVecOrMat{<:Real}) && size(arg1,2) <= 4) || (isa(arg1, Gdal.AbstractDataset) || isa(arg1, Gdal.AbstractGeometry)))
6969
(isa(arg1, Gdal.AbstractDataset) || isa(arg1, Gdal.AbstractGeometry)) && (arg1 = gd2gmt(arg1))
7070
isa(arg1, Matrix{<:Real}) && (arg1 = size(arg1,2) == 1 ? cat_1_arg(arg1, true) : mat2ds(arg1))
71-
isa(arg1, Vector{<:Real}) && (arg1 = mat2ds([1:length(arg1) arg1])) # Make it a 2D dataset with the first col = 1:ncol(arg1))
71+
if (isa(arg1, AbstractVector{<:Real}))
72+
arg1 = isempty(x) ? mat2ds([1:length(arg1) arg1]) : mat2ds([arg1 x])
73+
end
7274
if isa(arg1, Vector{GMTfv})
7375
ginfo = getbbox(arg1);
7476
isFV3D = (size(arg1[1].verts, 2) > 2)

src/utils.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ end
842842
Returns the coefficients for a polynomial p(x) of degree `n` that is the least-squares best fit for the data in y.
843843
The coefficients in p are in ascending powers, and the length of p is n+1.
844844
845-
The `xscale` parameter is useful when needing to get coeeficients in different x units. For example when converting
845+
The `xscale` parameter is useful when needing to get coeficients in different x units. For example when converting
846846
months or seconds into years.
847847
"""
848848
polyfit(D::GMTdataset, n::Int=size(x,1)-1; xscale=1) = polyfit(view(D.data, :,1), view(D.data, :,2), n, xscale=xscale)

0 commit comments

Comments
 (0)