How to set ticklabels for an image, within the range of x, and y

I searched this forum and the web for the Julia equivalent of extent in matplotlib.pyplot.imshow:

plt.imshow(M, origin="lower", extent=[a, b, c, d])

but I couldn’t find any reference. I need this feature for plotting complex functions on a given rectangle in the complex plane:

using Images, ImageTransformations
function perfract(x, t, m=0.7, M=1)
    x = x / t
    return m + (M-m) * (x-floor(x))

function domcol(w; n=10)
    logm = log.(abs.(w)) # for lines of constant modulus
    H = angle.(w)*180/π #compute argument of  w within interval [-180, 180], iei the Hue

    V = perfract.(logm, 2π/n) # lines of constant log-modulus
    arr = permutedims(cat(H, ones(size(H)), V, dims=3), [3,1,2]) #HSV-array

    return RGB.(colorview(HSV, arr[:, end:-1:1,:]))

f = z->z^2*tan(z)
x = -5π/4:0.005:5π/4
y = -2.5:0.005:2.5
w = [f(u+1im*v) for v in y, u in x]
img = domcol(w; n=13)
imgn = imresize(img, ratio=1/4)

Couldn’t you just use Plots.jl (with optional xlims, ylims arguments)?

using Plots; gr()
plot(x, y, imgn, xlims=(-3,2.2), ylims=(-1.5,2.5))



Thank you very much!!! Why you addressed a question? How could I know that this is possible? I searched the web two or three hours, but nowhere met such an example. I like so much Julia, but it is a nightmare to find out what attributes has a chart type. Almost no docstrings. After the transition from Python to Julia, the lack of docstrings in the packages and a reference to all attributes is what always urges me, “go back” :frowning:

1 Like

The reason for the question was that the sought Python functionality was unclear. :slight_smile:

This Plots.jl syntax for images appeared several times in Discourse posts.

Regarding the docs, they are in general quite good, the difficulty is that the number of options, recipes, etc, is massive. This section should partially address it.

You can also have complete control over the tick positions and labels using the xticks and yticks keywords:

julia> using Plots

julia> plot(1:10,rand(10),xticks=([3,7,8],["three","seven","eight"]),xrotation=60)