How to increase spacing between axis ticks in plot with a lot of data

조회 수: 92(최근 30일)
I have a plot that contains quite a lot of data that has key points where I need to focus on. My plot is a scatter plot, and has two sets of data overlaying one another.
I have set my x and y tick spacing to 0.5, but all this does is just increase the number of grid lines present in the graph. As each tick along my Y axis represents 10cm, this distance is way too much and I am trying to figure out a way to increase the space between each tick mark. So for example, if I were to put a ruler on my screen I would measure 1cm between each 0.5 tick mark. But what I want is the distance between each 0.5m tick mark to be 3cm , or 5cm or whatever I need.
Is there a command or a graph tool I could use to do this?
Example below: The plotted difference between the blue and the red is about 3cm, which is represented way too small on the graph. I want that distance spread out along the Y axis.

채택된 답변

Mohammad Sami
Mohammad Sami 2022년 7월 18일
since your data is only between 62.4 and 62.6, you can limit your y axis to these values using the ylim function.
fakedata = [linspace(62.6,62.4,100)' linspace(62.55,62.45,100)'];
a = axes();
ylim(a,[62.4 62.6]);

추가 답변(1개)

Chunru 2022년 7월 18일
A figure/screen/paper has limitted size. You may want to display them in subplot to maximize the screen asset.
fakedata = [linspace(62.6,62.4,100)' linspace(62.55,62.45,100)'];
n = size(fakedata, 1);
nsubplot = 4;
nsperplot = ceil(n/nsubplot);
for i=1:nsubplot
idx1 = nsperplot*(i-1) + 1;
idx2 = min(idx1-1 + nsperplot, n);
h(i) = subplot(nsubplot, 1, i);
plot(idx1:idx2, fakedata(idx1:idx2, :),'.');
%ylim(a,[62.4 62.6]);





Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by