Are you trying to make publication quality plots in MATLAB? Are you struggling with getting the ticks or tick labels to display properly? Would you like to visualize marginal distributions of your scatter data? Have you just read Edward Tufte's Visual Display of Quantitative Information and would like to try some of the small multiples, dot-dash plots, rug plots or range frames in MATLAB? Sounds like you need sideaxes.m!
sideaxes.m is a low level function that creates a new axes object besides a main axes object. On this new axes object, all of the labels, ticks, marginal distributions and other data are plotted just as one would plot on a typical axes object e.g. using line, text, plot and other commands. In practically all of the examples provided, MATLAB's internal axes are disabled using set(gca,'visible','off'), with all the ticks, labels and framelines added manually. sideaxes.m is accompanied by functions for adding ticks and labels, to bring back some of the convenience lost for not using MATLAB's internal ticks and labels.
The key novelty of sideaxes.m is that in its default mode of operation, the new axes object has a convenient coordinate system. The x-axis is linked to the original x- or y-axis of the parent, and y-axis is pointing away from the main axes. Y-coordinate is in centimeters, so you are effectively plotting in "centimeters away from the main axes". This coordinate system is convenient for ticks (e.g. dot-dash plots or having multiple scales on one axis) or range frames.
More information about the function at the GitHub pages: https://github.com/vsariola/sideaxes-m
Veikko Sariola (2020). sideaxes.m (https://github.com/vsariola/sideaxes-m), GitHub. Retrieved .
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!