bastibe / Violinplot-Matlab

Violin Plots for Matlab
https://mathworks.com/matlabcentral/fileexchange/170126-violinplot-matlab
BSD 3-Clause "New" or "Revised" License
256 stars 103 forks source link

Specifying axes #19

Open vindelico opened 4 years ago

vindelico commented 4 years ago

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

bastibe commented 4 years ago

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!

calboi91 commented 3 years ago

Hi,

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