 # How to properly set log axis scale with a 2d color plot?

I have a program which scans a 2d parameter space. For each point in the parameter space, it generates a colour (corresponding to system behaviours). The grid points are log10-log10 distributed. I wish to plot this, but cannot get the axis ticks to display properly, see attached code an image:

``````using Plots

x_grid = 10 .^(range(-0,stop=2,length=100))
y_grid = 10 .^(range(-0,stop=2,length=100))
color_grid = get_color_grid(x_grid,y_grid)

p1 = plot(y_grid,x_grid,color_grid,yflip=false,aspect_ratio=:none)
p2 = plot(y_grid,x_grid,color_grid, xscale=:log10,yscale=:log10,yflip=false,aspect_ratio=:none)
plot(p1,p2,size=(800,350))
``````

this results in:

Now, I basically want axis values like in the right plot, but on the plot to the left. I want a normal square grid of all my grid colors, like in the rightnost plot. But in the rightmost plot the axis values are all wrong (where it displays the value of 40, it should instead be 10 .^(range(-0,stop=2,length=100))

Any ideas of how I achive this?

Crosspost of my answer in the GitHub issue (https://github.com/JuliaPlots/Plots.jl/issues/3013):

You can provide the ticks and labels manually by passing a tuple of tick positions (vector of reals) and tick labels (vector of strings) to the `ticks` attribute:

``````plot(
y_grid,
x_grid,
color_grid,
yflip = false,
ticks = (range(1, 100, length = 5), ticklabels),
)
``````
1 Like