juliavisualizationgadfly

Julia: Gadfly size of colorbar


I'm currently trying to dive deeper into Gadfly.jl for plotting in Julia. I made a plot of a few stations on a map showing daily precipitation sums, but I'm rather unhappy with the size of the colorbar. I couldn't find a way to manipulate the size of the colorbar in the documentation. Does anyone know how to do this?

Here is the plotted map:

Here is the plotted map


Solution

  • Use themes to change the style of the colour bar.

    The simplest way just to change the font size of the key label and the title (RRsum on your image). E.g. add Theme(key_label_font_size=12pt, key_title_font_size=12pt) argument to your plot call.

    For example:

    plot(
        z=(x,y) -> x*exp(-(x-round(Int, x))^2-y^2),
        x=range(-8,stop=8,length=150),
        y=range(-2, stop=2,length=150),
        Geom.contour,
        Theme(key_label_font_size=10pt, key_title_font_size=10pt)
    )
    

    Smaller colorbar

    plot(
        z=(x,y) -> x*exp(-(x-round(Int, x))^2-y^2),
        x=range(-8,stop=8,length=150),
        y=range(-2, stop=2,length=150),
        Geom.contour,
        Theme(key_label_font_size=15pt, key_title_font_size=15pt)
    )
    

    Bigger colorbar