Filter löschen
Filter löschen

stuck on graph format! please help

1 Ansicht (letzte 30 Tage)
PetronasAMG
PetronasAMG am 4 Feb. 2018
Beantwortet: Walter Roberson am 4 Feb. 2018
so this is what I have..
but i need to make my graph look like this
as far as my coding,
grid on;
axis('equal')
posdegreeline = refline(tand(angle),0);
negdegreeline = refline(-tand(angle),0);
posdegreeline.Color = 'r';
negdegreeline.Color = 'r';
o1 = gca;
o1.XAxisLocation = 'origin';
o1.YAxisLocation = 'origin';
hold off;
my angle is 45 degrees but red lines suppose to end below the origin. I can't figure out why also is there a way to adjust scale even though i used axis('equal')??

Antworten (1)

Walter Roberson
Walter Roberson am 4 Feb. 2018
In order to do this using refline(), you will need to create a second axes in which the YLim upper value is the same as the YLim upper value in the original axes, but the YLim lower value is set to 0; and in the second axes, the XLim will need to be [-4 4]. Now use refline() in that second axes and record the handles. Now take the resulting line objects and set their Parent property to be the first axes (and then delete the second axes.)
Personally, I think it would be much easier just to do a line() or plot()
YL = ylim();
Ymax = YL(2);
plot([-Ymax 0 Ymax], [Ymax, 0, yMax], 'r-');

Kategorien

Mehr zu Specifying Target for Graphics Output finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by