Empty plot with colorbar and colorbar width

I’m using Plots with GR

Is it possible to make empty plot with colorbar?

I try:

plot(;colorbar=true, clims = (-0.05, 0.05),c = cg, zcolor = 1)

colorbar - not displayed.

Is it possible to change width of colorbar?

I try to do something like this:

But now it looks very bad.

I would use a layout and instead of the colorbar I would plot a heatmap with only the y-axis labels. See this solution.

1 Like

Unrelated to the previous answer, for this you need to plot some dummy data (ex: NaN), and use framestyle=:none

plot([1], [NaN]; colorbar=true, clims=(-0.05, 0.05), c=cgrad([:blue, :red]), framestyle=:none)
1 Like