Matlab multiple x axis one below the other

I am trying to create a Matlab plot with several x axes one below the other and only one y axis.

I looked at the Mathworks file exchange and there are only offers / scripts for the set of y-axis. I would like to get something like this question for R.

+7
matlab axis
source share
3 answers

Here is an example solution if you need only the second axis to display a different scale (Jeff_K solution, but more developed):

first_axis = gca; sqz = 0.12; %// distance to squeeze the first plot set(first_axis, 'Position', get(first_axis, 'Position') + [0 sqz 0 -sqz ]); ax2 = axes('Position', get(first_axis, 'Position') .* [1 1 1 0.001] - [0 sqz 0 0],'Color','none'); scale_factor = 42; %// change this to your satisfaction xlim(get(first_axis, 'XLim') * scale_factor); set(ax2, 'XScale', get(first_axis, 'XScale')); %// make logarithmic if first axis is too 
+4
source share

If you really do not need to display data on the secondary axes and just use them to display the scale (for example, for example, to which you are attached), you can do this simply by adding a second (or third, etc.)) in the appropriate position and setting the height very small:

 ax2 = axes('Position',[0.1 0.1 0.8 0.001],'Color','none') 

Then set the cue tags accordingly.

+3
source share

for this you need to use the patch function. See here http://www.mathworks.com/matlabcentral/fileexchange/26550-myplotyy for more details.

-one
source share

All Articles