|
On 6/22/2012 4:47 AM, BP wrote:
> I did the below to draw a histogram which reflects probability of a
> dataset (400x1), and use ksdensity to find out the probability
> distribution. X-axis has a range between -4 to 8. However, for histogram
> Y-axis has a value 0-180, whereas ksdensity Y-axis has a value 0-0.5.
> How can draw a graph with histogram and line graph in the same plot? I
> tried to use plotyy, however it doesn't seems to support the designated
> x-axis as I have to set the vector lengths of x = y = 400.
...
Did you try the two-handle version of plotyy, I guess? It didn't work
here w/ a trial but I have a very old release; it might have gotten more
flexibility since.
plotyy(X1,Y1,X2,Y2,'function1','function2')
It does use overlapping x-axes, though so unless it's gotten very clever
problem has same problem (or it's what you already tried w/ it)
I think you'll need to draw the second axis manually--there's example of
multiple axes plots at
<http://www.mathworks.com/help/techdoc/creating_plots/f1-11215.html>
--
|