From 782103a33e7e515d7bb085ccec6e3111f17fac4b Mon Sep 17 00:00:00 2001 From: monty Date: Sat, 14 Dec 2024 13:31:39 -0700 Subject: [PATCH] mapbox seems to work ok now --- src/NMFkIO.jl | 1 + src/NMFkPlotMap.jl | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/NMFkIO.jl b/src/NMFkIO.jl index a31f002..1f984c3 100644 --- a/src/NMFkIO.jl +++ b/src/NMFkIO.jl @@ -88,5 +88,6 @@ function joinpathcheck(path::AbstractString, paths::AbstractString...) else filenamelong = joinpath(path, paths...) end + recursivemkdir(filenamelong) return filenamelong end \ No newline at end of file diff --git a/src/NMFkPlotMap.jl b/src/NMFkPlotMap.jl index 5a26687..cd2200f 100644 --- a/src/NMFkPlotMap.jl +++ b/src/NMFkPlotMap.jl @@ -245,7 +245,7 @@ function mapbox(df::DataFrames.DataFrame; column::Union{Symbol,AbstractString}=" if !(occursin(regex_lon, a) || occursin(regex_lat, a)) println("Ploting $a ...") if filename != "" - f = filenameroot * "_" * string(column) * fileext + f = filenameroot * "_" * string(a) * fileext else f = "" end @@ -259,12 +259,12 @@ function mapbox(df::DataFrames.DataFrame; column::Union{Symbol,AbstractString}=" end end -function mapbox(lon::AbstractVector{T1}, lat::AbstractVector{T1}, color::AbstractVector{T2}; title::AbstractString="", text::AbstractVector=repeat([""], length(lon)), dot_size::Number=3, lonc::AbstractFloat=minimum(lon)+(maximum(lon)-minimum(lon))/2, latc::AbstractFloat=minimum(lat)+(maximum(lat)-minimum(lat))/2, zoom::Number=4, style="mapbox://styles/mapbox/satellite-streets-v12", mapbox_token=NMFk.mapbox_token, filename::AbstractString="", figuredir::AbstractString=".", format::AbstractString=splitext(filename)[end][2:end], width::Union{Nothing,Int}=nothing, height::Union{Nothing,Int}=nothing, scale::Real=1, legend::Bool=true) where {T1 <: Real, T2 <: Any} +function mapbox(lon::AbstractVector{T1}, lat::AbstractVector{T1}, color::AbstractVector{T2}; title::AbstractString="", text::AbstractVector=repeat([""], length(lon)), dot_size::Number=3, lonc::AbstractFloat=minimum(lon)+(maximum(lon)-minimum(lon))/2, latc::AbstractFloat=minimum(lat)+(maximum(lat)-minimum(lat))/2, zoom::Number=4, style="mapbox://styles/mapbox/satellite-streets-v12", mapbox_token=NMFk.mapbox_token, filename::AbstractString="", figuredir::AbstractString=".", format::AbstractString=splitext(filename)[end][2:end], width::Union{Nothing,Int}=nothing, height::Union{Nothing,Int}=nothing, scale::Real=1, legend::Bool=true, colorscale::Symbol=:rainbow) where {T1 <: Real, T2 <: Any} @assert length(lon) == length(lat) @assert length(lon) == length(color) @assert length(lon) == length(text) if legend - marker = PlotlyJS.attr(; size=dot_size, color=color, colorscale=NMFk.colorscale(:rainbow), colorbar=PlotlyJS.attr(; thickness=20, len=0.5, width=100, title=title), line_width=0, line_color="black") + marker = PlotlyJS.attr(; size=dot_size, color=color, colorscale=NMFk.colorscale(colorscale), colorbar=PlotlyJS.attr(; thickness=20, len=0.5, width=100, title=title), line_width=0, line_color="black") else marker = PlotlyJS.attr(; size=dot_size, color=color) end