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

99 vues (au cours des 30 derniers jours)
jabroni
jabroni le 18 Juil 2022
Réponse apportée : Chunru le 18 Juil 2022
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.
  2 commentaires
Chunru
Chunru le 18 Juil 2022
Attach your code and data.
jabroni
jabroni le 18 Juil 2022
no, you don't need any of that.

Connectez-vous pour commenter.

Réponse acceptée

Mohammad Sami
Mohammad Sami le 18 Juil 2022
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();
plot(a,fakedata,'.');
ylim(a,[62.4 62.6]);

Plus de réponses (1)

Chunru
Chunru le 18 Juil 2022
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, :),'.');
end
%ylim(a,[62.4 62.6]);

Catégories

En savoir plus sur Line Plots dans Help Center et File Exchange

Tags

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by