JuliaGraphics / Winston.jl

2D plotting for Julia

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add function fimagesc

sawcordwell opened this issue · comments

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.

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

I would probably find this very useful.

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'.

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