Arrowhead is turning the wrong way

4 Ansichten (letzte 30 Tage)
Rasmus Bruun
Rasmus Bruun am 10 Mai 2024
Kommentiert: Michel bertrand am 31 Mai 2024
The arrowhead is pointing the wrong way in the x-axis. See figure below.
Definerer alle landes forskydningsbæreevne
clc; clear; close all; clc ;
Forhold = 1/2 ;
Forhold2 = 54/228;
f_vk0 = 0.4 ; % Klæbningsbidrag [MPa]
mu_k = 0.65 ; % Friktionskoefficient
f_bt = 1.00 ; % Trækstyrke af sten [MPa]
f_k = 10.00 ; % Trykstyrke af sten [MPa]
sigma1 = -0.0:0.1:1.6 ;
sigma2 = 0.1:0.1:10.2;
sigma3 = 8.3:0.1:10 ;
sigma23 = 9.1:0.1:10 ;
Friction = (f_vk0 + mu_k * sigma1) / (1 + mu_k * 2 * Forhold) ;
Tension_failure = f_bt / 2.3 * sqrt(1 + sigma2/f_bt) ;
Compression_failure = (f_k - sigma3) * 1/Forhold*(1/2) ;
Friction2 = (f_vk0 + mu_k * sigma1) / (1 + mu_k * 2 * Forhold2) ;
Tension_failure = f_bt / 2.3 * sqrt(1 + sigma2/f_bt) ;
Compression_failure2 = (f_k - sigma23) * 1/Forhold2*(1/2) ;
Plotter forskydningsbæreevnerne
hf = figure() ;
hold on
plot(sigma1, Friction,'--','Color',[0.4660 0.6740 0.1880],'LineWidth',1.3)
plot(sigma2, Tension_failure,'--','Color',[0.9290 0.6940 0.1250],'LineWidth',1.3)
plot(sigma3, Compression_failure,'--','Color',[0.4940 0.1840 0.5560],'LineWidth',1.3)
plot(sigma1, Friction2,'LineWidth',1.3)
plot(sigma2, Tension_failure,'Color',[0.6350 0.0780 0.1840],'LineWidth',1.3)
plot(sigma23, Compression_failure2,'Color',[0.8500 0.3250 0.0980],'LineWidth',1.3)
% Shade the area between [sigma1, Friction] and [sigma1, Friction2]
% fill([sigma1, fliplr(sigma1)], [Friction, fliplr(Friction2)], [0.7 0.7 0.7], 'EdgeColor', 'none');
grid on;
xlim([0 12])
ylim([0 2])
% Shade the area between [sigma1, Friction] and [sigma1, Friction2]
[x0,y0,~,~] = intersections(sigma1,Friction,sigma2, Tension_failure);
ind = (sigma1<x0);
sigma1b = [sigma1(ind) x0]; % add x0 of true intersection point
Frictionp = [Friction(ind) y0]; % add y0 of true intersection point
[x1,y1,~,~] = intersections(sigma1,Friction2,sigma2, Tension_failure);
ind = (sigma1<x1);
sigma1c = [sigma1(ind) x1]; % add x1 of true intersection point
Friction2p = [Friction2(ind) y1]; % add y1 of true intersection point
% fill([sigma1, fliplr(sigma1)], [Friction, fliplr(Friction2)], [0.7 0.7 0.7], 'EdgeColor', 'none');
tt = fill([sigma1b, fliplr(sigma1c)], [Frictionp, fliplr(Friction2p)], [0.6350 0.0780 0.1840],'FaceAlpha',0.0,'EdgeColor', 'none');
hatchfill2(tt,'single','HatchAngle',-45,'HatchDensity',90,'HatchColor',[0.6350 0.0780 0.1840],'HatchLineWidth',1)
% Shade the area between [sigma3, Compression_failure] and [sigma3, Compression_failure2 ]
[x01,y01,~,~] = intersections(sigma3, Compression_failure,sigma2,Tension_failure);
ind = (sigma3>x01);
sigma1b = [x01 sigma3(ind)]; % add x0 of true intersection point
Frictionp = [y01 Compression_failure(ind)]; % add y0 of true intersection point
[x11,y11,~,~] = intersections(sigma23, Compression_failure2,sigma2,Tension_failure);
ind = (sigma23>x11);
sigma1c = [x11 sigma23(ind)]; % add x1 of true intersection point
Friction2p = [y11 Compression_failure2(ind)]; % add y1 of true intersection point
% fill([sigma1, fliplr(sigma1)], [Friction, fliplr(Friction2)], [0.7 0.7 0.7], 'EdgeColor', 'none');
tt2 = fill([sigma1b, fliplr(sigma1c)], [Frictionp, fliplr(Friction2p)], [0.6350 0.0780 0.1840], 'EdgeColor', 'none','FaceAlpha',0.0);
hatchfill2(tt2,'single','HatchAngle',-45,'HatchDensity',90,'HatchColor',[0.6350 0.0780 0.1840],'HatchLineWidth',1)
hax = gca;
hax.XDir = 'reverse'; % flip axis direction
hax.YAxisLocation = 'right'; % move ticks & labels to the other side
xlim([-2 12])
ylim([-0.5 2])
ha.Parent = hf.CurrentAxes; % associate annotation with current axes
% now you can use data units
ha.X = [-1.5 11];
ha.Y = [0 0] ;
%Define the variable
xac = -2; %x arrow coordinate
yac = 0; %y arrow coordinate
xas = 12; %x arrow shift
yas = 0; %y arrow shift
ha = annotation('arrow');
ha.Parent = hf.CurrentAxes; % associate annotation with current axes
% now you can use data units
ha.X = [-1.5 11];
ha.Y = [0 0] ;
ha = annotation('arrow');
ha.Parent = hf.CurrentAxes; % associate annotation with current axes
% now you can use data units
ha.X = [0 0];
ha.Y = [-0.4 2] ;
% remove old box and axes
box on
set(gca,'YColor',get(gca,'Color'))
set(gca,'XColor',get(gca,'Color'))
set(gca, 'FontName', 'Times New Roman', 'FontSize', 14)
set(gca, 'XTickLabel', {});
set(gca, 'YTickLabel', {});
legend({'Friction failure (M&M)','Tension failure (M&M)','Compression failure (M&M)','Friction failure (DK)','Tension failure (DK)','Compression failure (DK)'},'Location','northeast','NumColumns',1,'Orientation','vertical')
  1 Kommentar
Michel bertrand
Michel bertrand am 31 Mai 2024
Try negative head lenght, ha.HeadLength=-10; this works for me in a similar situation.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

VBBV
VBBV am 10 Mai 2024
Hi @Rasmus Bruun, In this line, you are trying to reverse the direction of X-axis (for unknown reason), If you comment the below line, the arrow head of x-axis graph seems to be fine
% hax.XDir = 'reverse'; % flip axis direction
  1 Kommentar
Rasmus Bruun
Rasmus Bruun am 11 Mai 2024
Thank you for your response!
Yes you are correct about making the arrow turn correct as below. But the reverse of the x-axis mirrors the envelope drawn between the arrows around the y-axis. This ensures the correct form but unfortunate the arrowhead is not reversing like the rest of it.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Geographic Plots finden Sie in Help Center und File Exchange

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by