Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

origin and spacing not taken into account when plotting #61

Closed
briochemc opened this issue Jun 3, 2020 · 2 comments
Closed

origin and spacing not taken into account when plotting #61

briochemc opened this issue Jun 3, 2020 · 2 comments
Labels

Comments

@briochemc
Copy link
Contributor

briochemc commented Jun 3, 2020

It seems that origin and spacing are not taken into account when plotting things onto grids.

(not-so-M)WE:

using Plots
origin = (-100.0, -200.0)
spacing = (5.0, 5.0)
X = origin[1]:100
Y = origin[2]:200
Z = [10sin(x/10) + y for x in X, y in Y]
plt1 = heatmap(X,Y,Z')
using GeoStats
Ω = RegularGridData{Float64}(OrderedDict(:Z=>Z))
RegularGridData(OrderedDict(:Z=>Z), origin .+ 1000, spacing)
plt2 = plot(Ω)
plot(plt1, plt2, layout=(2,1))

I was expecting the bottom plot to show the shifted origin and (5.0,5.0) spacing, but it does not?

Screen Shot 2020-06-03 at 10 16 18 am

@juliohm
Copy link
Member

juliohm commented Jun 3, 2020

I recall this wasn't possible with Plots.jl + GR.jl recipes back then, but perhaps the recipe system got updated. I am not sure. Do you think you could try fix the plot recipe here? https://github.com/JuliaEarth/GeoStatsBase.jl/blob/master/src/plotrecipes/domains/regular_grid.jl#L5-L24

Instead of returning the 2D matrix, we could return:

X = coordinates(domain)
...
elseif N == 2
...
X[1,:], X[2,:], Z

The actual plan is to move from Plots.jl recipes to Makie.jl recipes in the next milestone.

@juliohm
Copy link
Member

juliohm commented Jun 3, 2020

Fixed on master. Thanks for catching it 💯

@juliohm juliohm closed this as completed Jun 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants