Downsizing a Data Set for Plots

11 ビュー (過去 30 日間)
Articat
Articat 2019 年 10 月 31 日
コメント済み: Articat 2019 年 11 月 5 日
Image 1) I have one image in which the x-axes goes from -10 to 37 and y-axes: 6 to 56. I used a grid to shrink the image down to appropraite coords.
Plot 2) I have another plot in which the x-axes goes form 300 to 900 and y-axes: 100 to 800. This is a scatter plot of traced objects in 1 before the shrink.
Is there a way in which I can take plot 2 and convert the coordinates so it matches the coordinates of image 1?
For example in imagesc() you can call an xGrid, yGrid and then plot what you want on top of that like so: imagesc(xVecPLIF,yVecPLIF,Image). That is what I did for image 1.
Can I do somethig similar with just regular plots()?
Thanks for your help.
  1 件のコメント
Articat
Articat 2019 年 10 月 31 日
It would basically involve downsizing the matrix grid

サインインしてコメントする。

採用された回答

Subhadeep Koley
Subhadeep Koley 2019 年 11 月 4 日
Hi, You can use rescale() function to scale down / up your data to any given range. Refer to the code below. It scales a demo data between a given upper and lower range.
% Demo data for imagesc plot
imageData = magic(100);
% Plot your image data
imagesc(imageData);
% Set your preferred axis
axis([-10 37 6 56]);
hold all;
% Demo data for scatter plot
x1 = rand(1,500); y1 = rand(1,500);
% Rescale scatter plot data to your preferred range
x1_re = rescale(x1, -10, 37);
y1_re = rescale(y1, 6, 56);
% Scatter plot your rescaled data
scatter(x1_re,y1_re,'magenta','filled');
scaleScatter.png
Hope this helps!
  1 件のコメント
Articat
Articat 2019 年 11 月 5 日
Works great thanks!!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeScatter Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by