I am trying to learn how to use Makie with Julia, I have only used Winston so far. I am making a graph with latitude and longitude axis, and I want just their values on the axis, not the standard 1,5, and 10 that makie puts on all their axis. I also want to have my axis labeled, but I cant figure out how to separate the two -- to get rid of the numbers and keep the words. I am doing this in jupyter notebook.
I am importing netcdf data with multidimensional variables. I have already isolated the depth variable to one dimension for this. I have tried:
using NetCDF
using CairoMakie
using ColorSchemes
fig, axis, p=heatmap(lon1, lat1, h; labels=true, colormap=:rainbow_bgyrm_35_85_c71_n256)
Colorbar(fig[:, end+1], p, label="meters")
ax=Axis(fig[1,1], ylabel ="latitiude", xlabel="longitude", title="depth map",
leftspinevisible=false, bottomspinevisible=false, ticklabelvisible=false)
ax.aspect = 0.5
colsize!(fig.layout, 1, Aspect(1, 0.5))
display(fig)
and the graph I get is this : (https://i.stack.imgur.com/N2Npi.png) on the axis' is my lat/long numbers, the makie axis numbers that I dont want, and the labels that I do want.
Note: I get exactly the same looking graph with and without the code
leftspinevisible=false, bottomspinevisible=false, ticklabelvisible=false
in my axis command.
Next I tried :
hidedecorations!.(ax)
display(fig)
Which only got rid of all the makie labels- both numbers and labels:(https://i.stack.imgur.com/rNTmf.png)
I have also tried adding the condition: ticklabels=false
in the hide decorations code, after 'ax', still in parenthesis.
I have also already read through the documentation for labels and axis manipulation on the Makie webpage.
How can I keep the x/y labels while getting rid of the other numbers?
You are seeing double ticks and labels because you are adding a new axis to the figure on top of the axis that is created when you call
heatmap
. To make modifications to the axis that you already created, you can write to the fields of the returnedaxis
:Another option is to first create the axis with the properties you desire where you want it in a figure, then use the
heatmap!
method (with the exclamation mark) to draw the heatmap in that axis:These produce roughly the same figure: