In a perfect world, i would enjoy to plot on the x-axis all measures (first row) and have two separate line of dots for each genotype for each measure. I think it is impossible, so i plot first a plot of WT and after the plot to of MDX.
Then, i try to add my labels with :
% Adding x-axis
entete = alldata(1:1,3:end)
ax = gca;
ax.XTickLabel = entete;
ax.XTickLabelRotation = -45;
1. You first need a criterion of your own for determining what defines an outlier.
2. You have to do a *little* extra coding to highlight the points. Here is an example where we highlight the most positive point only. This is the case because I deliberately have avoided adding too many extra features such as this into the function. The idea is to make it easy for others to modify the plots as needed.
Here is a toy example:
Yes, a box-plot shows the median and quartiles, etc, so can be asymmetric and what not. If that's what you want, then use the MATLAB boxplot function. This version is, as the name says, /not/, a box plot. It uses the mean and statistics relating to the mean. These produce symmetrical error bars. There is rationale to this and, TBH, this function is aimed more at replacing bar charts than at replacing box plots.
The rationale is that t-tests and ANOVA are often performed on data which are typically plotted as bar charts and sometimes box-plots. However, tests are based upon the mean, yet box-plots show the median. Bar charts are often found supplemented with errors bars displaying 1 standard error of the mean (1 SEM), which does not reflect the p=0.05 significance criterion often used in biology and the social sciences. The 95% confidence interval used here provides a visual indicator of significance. In most bar charts the raw data are not overlaid, which greatly reduces the utility of the plot as it hides the underlying data. Yet with carefully chosen plot options, which is facilitated by this function, it's often possible to plot all the raw data even for large numbers of groups. I believe that overlaid raw data are usually more informative than quartiles and whiskers of a box plot. Of course that's a personal preference.
I might be mistaken, but isn't the line in a boxplot supposed to be the median?
I tried this with my data and the box is always symmetrical, whereas using the matlab boxplot function one can see how unevently distributed the data is (well, one can see that from the single datapoints plotted by 'notboxplot' too).
I am very excited to use this plotting tool but I'm having an issue. When I try to run the notboxplot code I get the following error.
"??? Maximum recursion limit of 500 reached. Use set(0,'RecursionLimit',N)
to change the limit. Be aware that exceeding your available stack space can crash MATLAB and/or your computer.
Error in ==> findobjhelper"
What should I set my recursion limit to so that the code works but I do not crash my computer? Or is there something else wrong?
x1 are the x values of the points in the first box. You can use this approach to get all the x and y data and then plot the lines. You can alter the order of the plot elements on the screen like this: http://www.matlab-cookbook.com/recipes/0050_Plotting/0010_Plot_Manipulation/changingPlotOrder.html
My only note of caution is that the plot may look messy because of the jitter along the x axis. You can modify the jitter with the 3rd input argument. If you have many data points then what you're doing may work better as a scatter plot. Perhaps my rug plot command would be of interest? http://www.mathworks.com/matlabcentral/fileexchange/27582-rug-plots
Great function, was looking for a way to plot my data points on my box-and-whisker plot and this seems to do the trick.
Was wondering if there were any suggestions on drawing correlating lines between data points and data sets. For example, I have a bunch of data points BEFORE an event for a collection of subjects and then bunch of data points taken AFTER an event for the same subjects. I would like to plot the two sets next to each other using this function and then have lines going from subject 1, before to subject 1, after and subject 2, before to subject, after, etc.
Q1. The function will return the coordinates of the means so you can use these with polyval. e.g.
Without "line" the above will return two data points for each mean (since the means are lines), but it's easy enough to work with that too. Does that work for you?
Q2. You can do this as follows:
How can I use this function with continuous spacing on x-axis?
p = [0.1 0.25 0.5 0.75 0.9];
will place the boxplots unevenly spaced along x-axis. Is there a way to do this with this function?
Great tool. It's an excellent way to visualize the distribution in a set of data. However, I've found that it does not appear work with 'gname' for labeling individual data points, whereas boxplot is able to do this. Any idea why that's the case?
I will soon be modifying this function to require no additional toolboxes. Otherwise, which function is best probably depends on the size of the data set. For large sample sizes the violin plots work best. For small sample sizes I prefer the plot style on this page, since it doesn't bin the data.
In opinion, a better replacement for the builtin boxplot is "Violin Plots for plotting multiple distributions (distributionPlot.m)" which does no require any additional toolboxes. Check:
Normally I'd say you should modify the plotted objects with the handles returned by the function. However, it would be awkward to do what you requested in this way. Consequently I've just submitted an update which should do what you want. The 4th argument can how have the values "sdline." If you want to alter the line properties, I recommend doing so by modifying the object properties via the handle returned by the function.
You can achieve these things in exactly the same way as you would for most other plotting commands. I try to avoid having functions behave too idiosyncratically. So, to answer your question:
The last two lines are obviously standard ways of setting labels and changing the axis limits. These work with any plot. Note that the notBoxPlot function returns the handles to the plot objects so that you can change their properties or even delete them. For example, you could remove all the data points by doing: delete([h.data])
1) How do you add labels to the x-axis like you would with the 'label' option in the boxplot function?
2) How can you specify what range should be plotted on the y-axis of notboxPlot?