Filter löschen
Filter löschen

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

3 Ansichten (letzte 30 Tage)
Anjana Ekka
Anjana Ekka am 21 Aug. 2021
Beantwortet: Wan Ji am 21 Aug. 2021
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?

Antworten (1)

Wan Ji
Wan Ji am 21 Aug. 2021
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')

Kategorien

Mehr zu Geometric Transformation and Image Registration finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by