Even after a decade of using Matlab, I still find myself occasionally getting tripped up by the (x,y) -> (y,x) switch. Consequently, when it comes to graphics in Julia, any code I've written I've been consistently choosing (x,y) indexing, and at least to me it's much clearer.
I vote we all invent a time machine to go back to the 1600s and fix the inconsistency between cartesian coordinates and how matrices are indexed/written. --Tim On Sunday, June 15, 2014 02:52:12 AM Tomas Lycken wrote: > A little while ago, Darwin Darakananda contributed an implementation of a > contouring algorithm to Gadfly > <https://github.com/dcjones/Gadfly.jl/issues/293#issuecomment-45709799>, to > facilitate plotting contour lines similar to MATLAB’s or PyPlot’s contour > routines. Since I had use for this functionality outside of plotting, I > suggested we’d package the algorithm separately - said and done > <https://github.com/tlycken/Contour.jl>. > > However, before we release this package officially and add it to METADATA, > there’s a decision that needs to be made where we want some input from the > community: > > *What is the best convention for the function data matrix in a contouring > method?* > > Basically, the problem is to represent 2D-data f(x,y) given two iterables x > and y with the coordinates on the grid points, and a matrix z with the > corresponding values of f(x,y), and there are two co-existing conventions > for this in the wild today: > > 1) z[xi, yi] = f(x,y), used by e.g. CoordInterpGrid in Grid.jl > <https://github.com/timholy/Grid.jl> > > 2) z[yi, xi] = f(x,y), used by e.g. contouring routines in MATLAB and > Python. > > Personally, I’ve always found the second convention confusing, and I almost > always have to transpose my data matrices to get the plots to look right. > But I realize that doing something different than what other languages do > might be equally confusing for others. > > *(We have thought a little about cache-friendliness, but the current > implementation of the algorithm doesn’t traverse the matrix in a way that’s > possible to make cache-friendly anyway, so that’s not an argument for or > against either convention at the moment.)* > > Please, voice your opinions here or on Github > <https://github.com/tlycken/Contour.jl/issues/2>. We’ll make a decision as > soon as there seems to be consensus (or if consensus seems unlikely, we’ll > make one anyway…). > > // Tomas >
