MATLAB: Creating a graph with both descending and ascending x-axis and one y-axis

2-d plotsticks

I am attempting to create an x-y graph in which the x-axis (log scale) has the following values:
1000, 100, 10, 1, 10, 100, 1000
The corresponding y-values are all positive.
I made such a plot by creating two subplots (A+B) and cutting and pasting them. So one graph (A) has descending x-values [1000,1] while the other (B) has ascending x-values [1,1000]. However, when I put them next to each other, I have tick marks where A and B join at x=1. I would like the ticks on the four sides of the box enclosing A+B but not at the vertical line at x=1. I don't think Matlab has an option to remove ticks on one side of a plot, i.e., the right side of A and left side of B.
Is there another way to do the above?
Thank you,
Vahid

Best Answer

Does this do approximately what you want?
ax(1) = axes('position', [0.1 0.1 0.4 0.8], 'box', 'off', 'yaxisloc', 'left', 'xdir', 'reverse');
ax(2) = axes('position', [0.5 0.1 0.4 0.8], 'box', 'off', 'yaxisloc', 'right');
set(ax, 'xlim', [1 1000], 'xscale', 'log');
That should get all of your requirements except having tick marks across the top of the plot. If you need those, you can add a couple additional axes, for decoration only:
ax(3) = copyobj(ax(1), gcf);
ax(4) = copyobj(ax(2), gcf);
set(ax(3:4), 'ycolor', 'none', 'xaxisloc', 'top', 'xticklabel', '', 'color', 'none');