JuliaGraphics / Winston.jl

2D plotting for Julia
MIT License
171 stars 55 forks source link

Add function fimagesc #230

Open sawcordwell opened 9 years ago

sawcordwell commented 9 years ago

Add a function fimagesc that is equivalent to fplot for imagesc. Specifically, let a colormap be generated for a function f that takes two arguments x and y over specified ranges for x and y.

sawcordwell commented 9 years ago

I have an initial version of this function written which I can post for review if it is deemed useful. Thanks

mvkma commented 9 years ago

I would probably find this very useful.

sawcordwell commented 9 years ago

I have created a branch for this function https://github.com/sawcordwell/Winston.jl/tree/fimagesc and would like some input. Specifically, what should I do about tests? It seems that not much of Winston is tested, and can it be tested?

Also, fplot uses some algorithm that I haven't looked at in detail yet to create points in some iterative manner. Would that also be a good idea for fimagesc? As a temporary solution I am just using a hard-coded 100 by 100 'resolution'.

mvkma commented 9 years ago

Nice, thanks!

I think it would be useful to export the 'resolution' as a parameter in fimagesc.

I also fixed a small bug, where typeof(f(xmin, ymin)) returns Int64, but the following values are not integers, so an InexactError is thrown. This happens for example with the following:

f = (x, y) -> x^2 - y^2
fimagesc(f, (-2, 2), (-2, 2))

I copied your branch (is that the right terminology?) and my changes are now here, if you're interested: https://github.com/slangangular/Winston.jl/tree/fimagesc