Resize correctly plot axis
    4 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
    Leonardo Vettore
 le 4 Juil 2016
  
    
    
    
    
    Réponse apportée : Thorsten
      
      
 le 4 Juil 2016
            Hi, I have a problem automatically resizing axis in a plot. I first have a figure with multiple plots with the x-axis in the range [0, 1000] and I save that figure, then I want to save the same figure but with the x-axis in the range [0, 200]. I would like the y-axis to adapt to the new cut, so that the y range will reduce, in order to have the minimum values to contain the plots in the new x cut.
I tryied to resize using "axis([0, 200, -inf, inf])", but the y-axis doesn't readapt, and mantain the same range that it previously had. I would like not to manually search the maximum and minimum for every function because it would be time expensive.
I want to do that in a script and not manually because it has to be automatic. Thank you!
0 commentaires
Réponse acceptée
  José-Luis
      
 le 4 Juil 2016
        Try something like this instead:
 aH = axes;
 plot(aH,rand(100,1));
 aH.XLim = [50, 65];
The Y axis should resize automatically.
0 commentaires
Plus de réponses (1)
  Thorsten
      
      
 le 4 Juil 2016
        If you have your data for x = 1, 2, 3, 4, ..., you can introduce a new variable
idx = 1:1000; % or idx = 1:200
and use in your subplots
plot(x(idx), y(idx)
0 commentaires
Voir également
Catégories
				En savoir plus sur Graphics Object Properties dans Help Center et File Exchange
			
	Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!