stuck on graph format! please help
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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')??
0 comentarios
Respuestas (1)
Walter Roberson
el 4 de Feb. de 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-');
0 comentarios
Ver también
Categorías
Más información sobre Graphics Object Properties en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!