0
$\begingroup$

I have code:

Manipulate[Graphics[Line[{{x1,y1},{x2,y2}}], Axes->True, AspectRatio->Automatic, PlotRange->{-10, 10}],{x1,-1,10,Appearance->"Labeled"},{y1,-1,10,Appearance->"Labeled"},{x2,-1,10,Appearance->"Labeled"}, {y2,-1,10,Appearance->"Labeled"}]

This code manipulates lines x1, y1, x2 ,y2 points. It draws line properly and manipulates. The problem is with AspectRatio->Automatic, PlotRange->{-10, 10} they do not work. Scale of x axis is not same as for y axis while I am manipulating values. The x axis is moving while I am manipulating values. If I remove AspectRatio->Automatic, PlotRange->{-10, 10} or PlotRange->{-10, 10} scale of x and y axises are becoming the same but the border of the plot changes when moving sliders.

Question: How to make AspectRatio->Automatic, PlotRange->{-10, 10} behave as it works for Plot[], so that scale of the axeses should be same and the plot size should not change?

$\endgroup$
1
$\begingroup$

See if this works for you.

Manipulate[
  Graphics[Line[{{x1, y1}, {x2, y2}}], Axes -> True, 
            PlotRange -> {{-10, 10}, {-10, 10}}], 
            {x1, -1, 10, Appearance -> "Labeled"}, 
            {y1, -1, 10, Appearance -> "Labeled"}, 
            {x2, -1, 10, Appearance -> "Labeled"}, 
            {y2, -1, 10, Appearance -> "Labeled"}]
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.