Closed rvenegas2014 closed 6 years ago
Is it possible to modify the position of the 'sampleSize' on the figure to skip overlapping when having multiple boxes
There is no implemented property or method for changing the position of the sample size text. You can use the handles (obj.handles.samplesTxt) to modify the properties of each text box directly.
How could ‘boxcolor’ colormap be changed to comply with perception-deficiencies
The property accepts a function handle as its argument, so you can provide whatever colormap function you want. Colormap functions accept one argument (the number of colours). With your example, you could wrap the function in an anonymous function, e.g.
myColorMap = @(n) ametrine(n,'gamma',1.8,'minColor','black','maxColor',[0 1 0]);
then pass myColorMap
as the argument.
Could be possible to modify individually the text format and size of a particular portion of the figure?
You can use the handles structure to modify the properties of any of those objects. Some of the handles will only be available if the corresponding option is enabled, e.g. obj.handles.samplesTxt will only be available if 'sampleSize' is set to true.
Could be possible to add a NaN to places where no data exist on a figure?
Where exactly would you plot non-existent data?!
How to add a horizontal reference line on the figure created by iosr.statistics.boxPlot(...) ?
Something like:
hold on;
y = 2; % whatever height you want the line
plot(get(gca, 'xlim'), [y y]);
How could the figure legend be fixed to a specific position within figure
set(obj.handles.legend, 'location', 'northwest')
Note: I haven't tested any of this code.
Thank you so much for your answer and for how quick your answer my requests. I tried all of your suggestions and they work great!
I will have to read more on handles structure to modify the properties of objects within this function.
Where exactly would you plot non-existent data?! In the figure attached, as an example, all my data at 'N' on first area 'Depth 0-3.99m' are NaN. Ideally would be great to have a symbol like '*' or 'NaN' or similar centered in the y-axis instead.
Sorry, one more question...
Now that the colormap can be changed to myColorMap, how can apply myColorMap to the outliers, to make those consistent with box color?
Mahalo!
This option answer my last question:
iosr.statistics.boxPlot(......, 'symbolColor',myColorMap)
I will have to read more on handles structure to modify the properties of objects within this function.
You can view all the available properties of a handle by typing, for example,
get(obj.handles.axes)
Then set them with
set(obj.handles.axes, 'propertyName', propertyValue)
Ideally would be great to have a symbol like '*' or 'NaN' or similar centered in the y-axis instead.
Personally I think that would be misleading. I'd prefer to state that the data are missing, and the reason they're missing, in the associated caption and/or prose. Either way, it's not trivial. You might be able to do something like
xtick = get(obj.handles.axes, 'xtick');
hold on
plot(xtick(1), y, '*')
% then perhaps use annotate() to write a label
how can apply myColorMap to the outliers
There is no straightforward way, and I have no time to implement such a feature (nor access to Matlab). Something like this might work:
for n = 1:numel(obj.handles.box)
set(obj.handles.outliers(n), 'markeredgecolor', get(obj.handles.box(n), 'facecolor'))
end
Again, this is untested.
Thanks!
This as a great tool, Mahalo for creating and sharing this with us!
I apologize in advance if any of my questions have already an answer (if so, please direct me to those answers).
1) Is it possible to modify the position of the 'sampleSize' on the figure to skip overlapping when having multiple boxes (e.g. rotate it, have an individual legend (color = value) within each section of a figure, have a reference box as part of legend, or shift position between top and bottom of consecutive boxes?
2) How could ‘boxcolor’ colormap be changed to comply with perception-deficiencies (colorblind, as now required for publications and federal documents)? I tried @gray and works fine, but including other colormap-for-colorblind people would be appreciated.
Something like..?. h=iosr.statistics.boxPlot(...) ... set(h.handle.boxcolor, colormap(ametrine(256,'gamma',1.8,'minColor','black','maxColor',[0 1 0])));
This colormap comes from: https://www.mathworks.com/matlabcentral/fileexchange/31761-colormaps-compatible-with-red-green-color-perception-deficiencies
3) Could be possible to modify individually the text format and size of a particular portion of the figure?
Something like...? h=iosr.statistics.boxPlot(...) ... set(h.handles.groupLabels, 'Rotation', 90);
I also tried... set(h.handles.samplesTxt, 'Rotation', 90); But geeting this error: Reference to non-existent field 'samplesTxt'.
4) Could be possible to add a NaN to places where no data exist on a figure?
5) How to add a horizontal reference line on the figure created by iosr.statistics.boxPlot(...) ?
6) How could the figure legend be fixed to a specific position within figure, like... Northwest, Northeast, etc?
This is what I am working on:![image](https://user-images.githubusercontent.com/9973980/37361263-97cbc530-2696-11e8-8bbe-cd58111de8a3.png)