Friday, January 31, 2014

Script:; Draw a colorbar using diamond shapes on your plots.

I have not added anything to this blog as of late, I have been busy with a number of different projects including my participation in the OWLeS field project.  Recently I have seen a few presentations that showed figures that had color bars made up of diamonds rather than rectangles (see below).  I figured it might be fun to put together a quick script that allows you to do this in GrADS.
Colorbar with diamonds using

Example usage:
            'diamondbar -r -marg 0.1 -font 0.09 -fs 2'

This is the call used to plot the colorbar on the above example. 

Options:        -help           - Pulls up this Help Page
                       -loc             - Chooses location for the colorbar (r=right-vertical,                                                                            l=left-vertical, b=bottom-horizontal,t=top-horizontal)                                                                             can also be called by (-l,-r,-b,-t)'
                        -size/s        - sets size of each diamond, defaults to "auto"
                        -marg            - sets margin to axis
                        -fs/int         - sets the interval for each number plotted along the colorbar
                        -font/fontsize  - sets the font size of the numbers
                        -scol           - sets the color of the numbers
                        -line           - draws outline around each diamond if included  

Anyway, I had some free time recently, and I got inspired to write a new script, so I quickly put together this script.  I haven't used it too much, but I certainly see how and where it could be useful, perhaps to add a little flare to your figures.  Enjoy!  And as always, report any bugs!

Note:  The example script will generate the plot above and requires the script


Download Example Script


  1. Your blog is an excellent resource for Grads. Thank you so much for putting this together.

    1. I can't believe it took me so long to see this comment! Thank you for the kind words!