Quick version
How can I control the x and y values โโfor a 3-D line chart in Matlab?
More details
Suppose we have a 10 x 20 data matrix and we build it with bar3 , and we want to set the x and y values. For example:
foodat = rand(10,20); xVals = [5:14]; yVals = [-3:16]; bar3(xVals, foodat); xlabel('x'); ylabel('y');
Is there a way to submit and yVals? Otherwise, the y axis always defaults to [1: N].
Note. I do not just want to change tags using XTickLabel and YTickLabel . I need to change the actual values โโon the axis, because I draw several things in the same figure. It is not enough just to change how the labels (incorrect) of the axis are marked. So this is different from questions like:
How to set up 3D bar grouping and Y axis marking in MATLAB?
Other things I've tried
When I try to change xvals with
set(gca,'XTick', xVals) set(gca,'YTick', yVals)
The values โโare taken, but are actually displayed on the wrong axes, so it seems that the x and y axes are switched using bar3. Also, it's still too late, since the histogram has already been plotted with the wrong x and y values, so we will eventually give ticks for the null values.
Note added
Matlab tech support just emailed me to inform me of a scatterbar3 custom function that does what I want differently from the accepted answer:
http://www.mathworks.com/matlabcentral/fileexchange/1420-scatterbar3
matlab matlab-figure
neuronet
source share