# Scaling down values to plot on the same figure

1 visualizzazione (ultimi 30 giorni)
Fawad Farooq Ashraf il 5 Feb 2022
I have a dataset with x and y values (basically a trajectory plot). I've plotted them as shown in the attached figure. I've to plot some markers on this trajectory. My problem is that I've to plot the markers obtained from different methods (6 methods) and to properly distinguish them, I cannot plot them on the same figure. I do not want to plot them in separate figures or in subplots either. The idea I have is to scale down the figure like I have shown in the attached figure. I'll remove the x-tick and y-tick values in any case. Scaling down the y-axis is easy but I can't think of a way to scale the x-axis i.e., I have to shift the 1st value forward and the last value backward. Can anybody help me do it?
##### 6 CommentiMostra 4 commenti meno recentiNascondi 4 commenti meno recenti
Simon Chan il 5 Feb 2022
Slightly modify the code as follows:
x = 10:10:700;
y = -(x-350).^2;
y = y - min(y);
figure
plot(x,y)
grid on
x_ratio = 0.5; % scaling factor for x
y_ratio = 0.8; % scaling factor for y
[~,idx.max]= max(y); % Finding index for maximum y
xnew = x_ratio*(x-x(idx.max)); % Center the curve and apply x-scaling factor
xnew = xnew+x(idx.max); % Apply offset to move the highest point to the original location
hold on
plot(xnew,y*y_ratio) % Apply scaling factor for y
grid on Fawad Farooq Ashraf il 5 Feb 2022
this seems a lot better
thank you

Accedi per commentare.

### Categorie

Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange

R2021a

### Community Treasure Hunt

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

Start Hunting!