i trying make figure in matlab has grid lines @ custom places, want write ticks @ regular intervals. produced following graph, grid lines in right position:
plot(mydata); xlabel('frequency'); ylabel('maginute'); set(gca, 'xtick', listoftheoreticalvalues); set(gca,'xgrid', 'on'); set(gca, 'xticklabel', '');
the problem facing now, however, can't put normal, equally spaced ticks on x-axis, let alone marking values, because add grid lines too. there way separate 2 things each other?
as hugh nolan suggested, manually adding grid lines 1 way solve problem. following code trick:
%grid line locations x_lines = listoftheoreticalvalues; y_limits = [lower_y_limit; upper_y_limit]; %insert desired y-limits here y_grid = repmat(y_limits, 1, numel(x_lines)); x_grid = [x_lines; x_lines]; plot(x_grid, y_grid, ':', 'color', [1,1,1]/2); %first plot grid lines hold on plot(mydata); %then plot data draw data on top of grid lines xlabel('frequency'); ylabel('maginute');
Comments
Post a Comment