How to make discrete pcolor x-axis with no gaps between datapoints?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MP
le 11 Juil 2022
Réponse apportée : Steven Lord
le 11 Juil 2022
Is it possible to make a plot of continous discrete data? Something like shown in figure below? This is a simple representation of problem.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1061025/image.png)
Here, B-axis is continous, while A-axis is discrete. Though the x-axis breaks, I do not want any gap between the datapoints. Basically, A-axis does not run continously from 0-300. Rathar it should select discrete x-points, 0-3-4-7-9 etc.... and make a continous plot.
Also, I would like to clarify that I am not making a 2-D plot (like the one shown here), I have a "pcolor plot".
Any help will be greatly appriciated.
0 commentaires
Réponse acceptée
Steven Lord
le 11 Juil 2022
So instead of doing something like plotting data points with their actual X coordinates:
v = 1:10;
x = v.^2;
stem(x, v)
You want to plot the data points at x = 1, 4, 9, 16, etc. separated by only one space? If so, the easiest way is not to change the data but to change the labels.
figure
stem(v, v);
xticks(v);
xticklabels(string(x))
Though that could lead to erroneous conclusions on the part of people looking at your graph.
0 commentaires
Plus de réponses (1)
Bharat Chandra Mukkavalli
le 11 Juil 2022
Hi,
Refer to the link on plotting discrete X values here: https://www.mathworks.com/matlabcentral/answers/612426-how-to-plot-discrete-values-on-the-x-axis
Hope this helps!
0 commentaires
Voir également
Catégories
En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!