File Exchange

image thumbnail

CDOT - Creating circular dot plots

version (3.4 KB) by Jochen Smolka
Plot angular data in a circular dot histogram


Updated 23 Jun 2016

View License

Circular can be plotted using Matlab's inbuilt rose function, but the resulting plots are not very pretty (and also overrepresent large values). Instead, this function plots data as circular dot plots.
Three functions are included: cdot_plot is the main function, which calculates the histogram and then calls cdot_hist to create the plot. The third function, cdot_label, can be used to add ticks and labels to the plot. Both cdot_plot and cdot_hist take a number of optional inputs to modify the appearance of the plot (see examples below or comments in the functions), and give the option to append dot plots to an existing graph. This latter option allows the user to plot two datasets into one graph with different dot colours.
0) Create some random example data.
angles1 = randn(30, 1)*90+180;
angles2 = randn(30, 1)*90+180;

1) Plot data using defaults, and label it:
r = cdot_plot(angles1); % the output variable r defines the outer radius of the dotplot
cdot_label(0:30:330, r); % if r is not provided, the function will make a guess based on the largest rectangle object

2) Plot data with custom colours, and label with compass directions
r = cdot_plot(angles1, 5, 'k', 100, 7);
cdot_label(0:45:315, r, [], [], [], [], {'N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW'});

3) Plot both data sets in different colours, then label
cdot_plot(angles1, 5, 'b', 100, 7);
cdot_plot(angles2, 5, 'r', 100, 7, [], '-a');

Comments and Ratings (2)

David Wilby

Hej Jochen! Thanks for the functions!

john clark


Replaced example image

MATLAB Release Compatibility
Created with R2016a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.

Learn About Live Editor