Plots.jl: Control colorbar size (and other attributes?)

Created on 29 Aug 2016  路  2Comments  路  Source: JuliaPlots/Plots.jl

As far as I can tell, there isn't a good way to set the size/scale of the colorbar (see, e.g., https://github.com/stevengj/PyPlot.jl/issues/93)

The following would be nice:

X = randn(100,100)
heatmap(X; colorbar=:left)       # works with some backends already (not pyplot?)
heatmap(X; colorbar=0.5)        # half the default size
heatmap(X; colorbar=[-2,0,2])  # tick marks?

I did a bit of digging to see if I could figure out how to implement the scaling. In PyPlot, you can do the following:

screen shot 2016-08-28 at 6 34 23 pm

screen shot 2016-08-28 at 6 34 07 pm

So my original thought was to use the fraction keyword. But, it looks like PyPlot.colorbar(...) isn't called directly by Plots? It looks to me like a new axis with a hard-coded size is created here (am I parsing that correctly?):

https://github.com/tbreloff/Plots.jl/blob/master/src/backends/pyplot.jl#L816

Thanks again for your patient guidance through all of these details Tom.

enhancement

Most helpful comment

It would also be great to have to usual font-selection keywords for colorbar ticklabels and colorbar_title.

All 2 comments

It would also be great to have to usual font-selection keywords for colorbar ticklabels and colorbar_title.

See also #302

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dancsi picture dancsi  路  4Comments

Cody-G picture Cody-G  路  4Comments

mkborregaard picture mkborregaard  路  3Comments

SebastianM-C picture SebastianM-C  路  4Comments

PallHaraldsson picture PallHaraldsson  路  4Comments