Reputation: 3667
I have the following plot with the markers designating the average and the errorbars mark the minimum and maximum values. As you can see, it is very difficult to tell the difference between the different data points because they overlap.
I removed the legend so this plot can more easily be seen by the way.
My idea was to split the plot into two separate plots, 1 with the data from 0 to .25, the other plot with data from .35 to .6, but I'm not sure if that would improve things much or would look terrible.
I was hoping some seasoned MATLAB users would have some ideas on how to modify my plot (e.g. change axis limits, use axis square or axis image, or something else that I don't know).
I even tried switching to a log plot using the command set(gca,'XScale','log');
but here is my result:
Upvotes: 1
Views: 536
Reputation: 3667
This solution from the MATLAB file exchange might end up looking better:
Panel-File Exchange-MATLAB Central
Basically I created two separate figures. The first one features the entire graph. The second figure shows a zoomed in version of the points that aren't visible. These points shared a similar characteristic that made them the best.
So I labeled the first graph "All options" The second graph "Options featuring best tradeoffs"
I didn't end up using panels. I created separate graphs so that I could resize them easily, but Panel would do something similar.
Upvotes: 1
Reputation: 7895
This is along the lines of what Try Hard suggested in a comment.
The following code is a copy/paste example to create a data-set similar to what you seem to have, plot it and then add a zoomed plot in the empty region:
% generate example data-set
% for the sake of simplicity, the x-data will be ascending
X(1:5,1) = sort(rand(5,1)*0.05+0.1);
X(6:7,1) = sort(rand(2,1)*0.1+0.5);
Y(1:5,1) = rand(5,1)*10+50;
Y(6:7,1) = rand(2,1)*10+90;
Yerr = rand(7,2)*25;
% initial errorbar plot
eax = axes('Position', [0.15, 0.15, 0.75, 0.75]);
errorbar(eax,X,Y,Yerr(:,1),Yerr(:,2),'ob')
hold on
% control axis range
XMIN = min(X)-0.05;
XMAX = max(X)+0.05;
YMIN = min(Y-Yerr(:,1))-10.0;
YMAX = max(Y+Yerr(:,2))+10.0;
xlim([XMIN XMAX]);
ylim([YMIN YMAX]);
% determine max distance between the two groups
% and its location (index)
[MD, IMD] = max(X(2:end)-X(1:end-1))
% set up zoomed plot
% based on know axis limits and location
% the position of the zoomed plot can be
% set up parametrically:
X1 = (X(IMD,1) + MD * 0.1)/(XMAX-XMIN);
Y1 = (YMIN + 10)/(YMAX-YMIN);
DX1 = 0.35;
DX2 = 1.0;
zax = axes('Position', [X1, Y1, DX1, DX1]);
errorbar(zax,X,Y,Yerr(:,1),Yerr(:,2),'ob')
set(zax,'XLim',[XMIN+0.04 X(IMD)+0.01],'Title',text('String','zoomed'))
This code produces a plot like this:
Upvotes: 3