From: B. Schmidt on
Hello,

I am using the boxplot to show twelve indivdual "boxes" corresponding to twelve columns in a 2D matrix (datatype = double). There is a different number of values in each column. I have padded the columns with Nan values to allow the matrix to exist. I use this Nan padded matrix (e.g. 1178 rows x 12 columns) as the inpout into the boxplot function:

boxplot(my2Dmatrix)

This draws the boxplot and that is where the trouble begins. When I now use the Data Cursor to display the various points on the plot I get an error message. The message is the error shown below. Is this a know glitch and is there a known fix?

Any insights would be much appreciated.

??? Error using ==> set
Values must be finite and non-NaN

Error in ==> boxplot>repositionLabels at 3281
set(ax,'LooseInset',newLi);

Error in ==> boxplot>@(src,evt)repositionLabels(ax) at 3092
list2 = addlistener(ax, props, 'PostSet',@(src,evt)
repositionLabels(ax));

Warning: Error occurred while evaluating listener callback.
> In graphics.datatip.datatip>localSetBestOrientation at 480
In graphics.datatip.datatip>localUpdatePositionFromDataCursor at 712
In graphics.datatip.datatip>localSetPosition at 627
In graphics.datatip.update>localZStacking at 95
In graphics.datatip.update at 33
In datacursormode>localWindowButtonDownFcnDatatip at 785
In datacursormode>localWindowButtonDownFcn at 610
In hgfeval at 63
In uitools.uimode.modeWindowButtonDownFcn at 84
In uitools.uimode.modeControl>localModeWindowButtonDownFcn at 140
From: B. Schmidt on
"B. Schmidt" <bschmidt0123(a)gmail.com> wrote in message <hvnskq$qa3$1(a)fred.mathworks.com>...
> Hello,
>
> I am using the boxplot to show twelve indivdual "boxes" corresponding to twelve columns in a 2D matrix (datatype = double). There is a different number of values in each column. I have padded the columns with Nan values to allow the matrix to exist. I use this Nan padded matrix (e.g. 1178 rows x 12 columns) as the inpout into the boxplot function:
>
> boxplot(my2Dmatrix)
>
> This draws the boxplot and that is where the trouble begins. When I now use the Data Cursor to display the various points on the plot I get an error message. The message is the error shown below. Is this a know glitch and is there a known fix?
>
> Any insights would be much appreciated.
>
> ??? Error using ==> set
> Values must be finite and non-NaN
>
> Error in ==> boxplot>repositionLabels at 3281
> set(ax,'LooseInset',newLi);
>
> Error in ==> boxplot>@(src,evt)repositionLabels(ax) at 3092
> list2 = addlistener(ax, props, 'PostSet',@(src,evt)
> repositionLabels(ax));
>
> Warning: Error occurred while evaluating listener callback.
> > In graphics.datatip.datatip>localSetBestOrientation at 480
> In graphics.datatip.datatip>localUpdatePositionFromDataCursor at 712
> In graphics.datatip.datatip>localSetPosition at 627
> In graphics.datatip.update>localZStacking at 95
> In graphics.datatip.update at 33
> In datacursormode>localWindowButtonDownFcnDatatip at 785
> In datacursormode>localWindowButtonDownFcn at 610
> In hgfeval at 63
> In uitools.uimode.modeWindowButtonDownFcn at 84
> In uitools.uimode.modeControl>localModeWindowButtonDownFcn at 140

I am replying to my previous message since I have found the cause of the error.
I was inadvertantly sttign the "ylim" of the boxplot to be a negative number upto a positive number. By setting the "ylim" to be entirely positive the error was corrected. It must have soemthing to do with how the boxplot datatip function handles drawing somehow and it does not like negative values for the y-axis. I hope this post helps anyone that might run into a similar problem.