How can I make plots in MATLAB like in below? 
I won’t need labels, so you can ignore them. I tried using normal 2D plot, by giving 0 to y parameter for each data points. It does help, but most of the plot remains empty/white and I don’t want that. 
How can I solve this problem?
Edit:
This is how I plot(playing with values of ylim does not help):
hold on
for i=1:120
if genders(v_labels(i)) == CLASS_WOMAN
plot(v_images_lda(i,:) * w_lda,0,'r*');
else
plot(v_images_lda(i,:) * w_lda,0,'b.');
end
end
title('LDA 1D Plot');
ylim([-0.2 0.2]);
hold off
Here’s one way to reproduce your figure using
dsxy2figxyandannotate.dsxy2figxycan be hard to find the first time, as it is not really in your path. It is part of the MATLAB package and is provided in the example functions. You can reach it by searching for it in the help docs and once you find it, open it and save it to a folder in your path.This will produce the following figure:
This is sort of a hackish way to do it, as I’ve tricked MATLAB into printing just one subplot. All rasterized formats (
jpeg,png, etc) will not give you the same result, as they’ll all print the entire figure including where the non-declared subplots should’ve been. So to get this effect, it has to be aneps, and it works with it because eps uses much tighter bounding boxes… so all the meaningless whitespace is trimmed. You can then convert this to any other format you want.