フィルターのクリア

Graph in tiff format : how to interchange X and Y axis ?

3 ビュー (過去 30 日間)
Anjana Ekka
Anjana Ekka 2021 年 8 月 21 日
回答済み: Wan Ji 2021 年 8 月 21 日
I have a graph in PNG format. I don't have the basic data to generate another graph. I want to inter-change the X and Y axis ? How can I extract the data from image?

回答 (1 件)

Wan Ji
Wan Ji 2021 年 8 月 21 日
I usually use GetData software. while with matlab, I wrote code for this problem below
% Extract data from image
clc;clear
figName = input('Insert the name of you picture(jpg or png)\n','s');
myFig = imread(figName);
figure(11)
imshow(myFig);
xmin = input('min of x:');
xmax = input('max of x:');
ymin = input('min of y:');
ymax = input('max of y:');
nCurve = input('input number of curves: n\n');
title('click left_up corner and right c_down orner in the axis:')
[xcor, ycor] = ginput(2);
Curve = struct([]);
for i = 1:1:nCurve
title(['Please click the points of ',num2str(i),'th curve(end with enter)'])
[Curve(i).x , Curve(i).y]= ginput(100);
Curve(i).x = xmin+(Curve(i).x - xcor(1))./(xcor(2)-xcor(1))*(xmax-xmin);
Curve(i).y = ymin+(Curve(i).y - ycor(2))./(ycor(1)-ycor(2))*(ymax-ymin);
end
figure(12)
Leg = cell(nCurve,1);
color = 'rgbkcmrgbkcmrgbkcm';
marker = '^osd><hvposd><hvposd><hvp';
for i = 1:1:nCurve
plot(Curve(i).x,Curve(i).y, [color(i),'-',marker(i)],...
'markerfacecolor',color(i),'markersize',5)
hold on
Leg{i,1} = ['Line ',num2str(i)];
end
axis([xmin xmax ymin ymax])
legend(Leg);
xlabel('X')
ylabel('Y')
set(gca,'fontsize',15)
save(['Curve',figName,'.mat'],'Curve')

カテゴリ

Help Center および File ExchangeGeometric Transformation and Image Registration についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by