MakieOrg / GeoMakie.jl

Geographical plotting utilities for Makie.jl
https://geo.makie.org
MIT License
167 stars 24 forks source link

Conflict with multiple dispatch of plot() #130

Closed alicedb2 closed 2 years ago

alicedb2 commented 2 years ago

I'm using GeoMakie v0.4.2. I have this very simple problem with multiple dispatch. I have my own module which export a plot function with the signature

module MyModule
import RecipesBase: plot
[...]
export plot
[...]
function plot(chain_state::MNCRPchain; burn=0)
[...]
end

Now if I do

] activate .
julia> using GeoMakie
julia> using MyModule

julia > chain_state = [...]
julia> plot(chain_state)
WARNING: both GeoMakie and MyModule export "plot"; uses of it in module Main must be qualified
ERROR: UndefVarError: plot not defined

This only happens with GeoMakie. There's no problem if for example I load my module together with Plots.jl or StatsPlots.jl.

How come multiple dispatch doesn't seem to do its job here? There's no way there should be confusion with this type of signature. And again it only happens with GeoMakie.

SimonDanisch commented 2 years ago

Well, GeoMakie uses Makie instead of Plots, so Makie.plot will conflict with Plots.plot....

alicedb2 commented 2 years ago

I'm exporting my own plot function and that's what's conflicting with GeoMakie regardless of whether I use Plots/StatPlots or not. This is what the Warning is reporting. But I do notice now that CairoMakie lead to the same issue so maybe I should that that up with them. Also I can't really give up Plots because I need histogram2d which is not implemented by Makie.

SimonDanisch commented 2 years ago

Have you seen https://github.com/MakieOrg/Makie.jl/issues/958#issuecomment-845387920?