Violinplot-Matlab icon indicating copy to clipboard operation
Violinplot-Matlab copied to clipboard

Specifying axes

Open vindelico opened this issue 4 years ago • 2 comments

Hello bastibe,

very nice implementation of very useful plots! Thank you!

When making MANY plots I like to pass the axes to plotting functions, like plot(ax,__), boxplot(ax,__), scatter(ax,__); sometimes text(__, 'Parent', ax) is required. This prevents messing up plots when you click on a finished one on your screen while a loop is still running. The figure/axes you clicked will get the focus and then gcf/gca will point and plot to the wrong figure/axes.

I tried to find where to add a specific axes in the Violin class, passed over to the constructor from violinplots but I couldn't quit figure out how to do it in the varargs parsing. So I guess this makes my comment kind of a feature idea. ;-)

Cheers, Marco

vindelico avatar Jul 11 '20 05:07 vindelico

Very good idea!

It is actually a bit shameful that I didn't implement this in the first place, as I have been teaching and advocating for this style of programming for a few years now.

That said, I am afraid I don't have a lot of time to spend on this issue right now. If you or someone else would like to contribute a pull request, however, I would be extremely grateful!

bastibe avatar Jul 13 '20 09:07 bastibe

Hi,

I added an option to specify axes parent, using the 'Parent' varargin parameter. It is pull request #24.

calboi91 avatar Feb 16 '21 22:02 calboi91