0
$\begingroup$

I want to compare 2 plots, and view that 4 lines are exactly the same tangent.

So I would like to view 2 images with the same scale in the y-axis and the same scale in the x-axis

How can I do this. AspectRatio it´s not a solution for me becasue is a ratio for the image not for the scale

Expr1 = -alfa + 1;
Expr2 = -2 alfa + 2;
Expr3 = 5 alfa;
Expr4 = -alfa + 1;

Plot[{Expr1, Expr2, Expr3, Expr4}, {alfa, 0, 1},
 BaseStyle -> AbsoluteThickness[4], 
 PlotLegends -> 
  LineLegend["Expressions", BaseStyle -> AbsoluteThickness[4]], 
 AspectRatio -> 1]

If you plot this one, the same lines moved up/down, you can see that the sacale of y-axis is diferent because the y-range is longer.

Expr1 = -alfa - 2;
Expr2 = -2 alfa + 4;
Expr3 = 5 alfa;
Expr4 = -alfa - 1;

Plot[{Expr1, Expr2, Expr3, Expr4}, {alfa, 0, 1},
 BaseStyle -> AbsoluteThickness[4], 
 PlotLegends -> 
  LineLegend["Expressions", BaseStyle -> AbsoluteThickness[4]], 
 AspectRatio -> 1]

I want to maintain the same scale in the y-axis

$\endgroup$

1 Answer 1

0
$\begingroup$
Expr1 = -alfa + 1;
Expr2 = -2 alfa + 2;
Expr3 = 5 alfa;
Expr4 = -alfa + 1;

p1 = Plot[{Expr1, Expr2, Expr3, Expr4}, {alfa, 0, 1},
  BaseStyle -> AbsoluteThickness[4],
  PlotLegends -> 
   LineLegend["Expressions", BaseStyle -> AbsoluteThickness[4]],
  PlotRange -> {Automatic, {-5, 5}},
  AspectRatio -> 1];


Expr1 = -alfa - 2;
Expr2 = -2 alfa + 4;
Expr3 = 5 alfa;
Expr4 = -alfa - 1;

p2 = Plot[{Expr1, Expr2, Expr3, Expr4}, {alfa, 0, 1},
  BaseStyle -> AbsoluteThickness[4],
  PlotLegends -> 
   LineLegend["Expressions", BaseStyle -> AbsoluteThickness[4]],
  PlotRange -> {Automatic, {-5, 5}},
  AspectRatio -> 1];

Grid[{{p1, p2}}]

enter image description here

$\endgroup$
3
  • $\begingroup$ perfect That´s what I wanted, but... do you know any way to obtain as independent plots?, without a grid. Because I want to save the legends with the rigth bracket option SAVE AS... $\endgroup$
    – Mika Ike
    Commented Jul 16, 2014 at 18:39
  • 1
    $\begingroup$ @mika Ike@ Just remove the semicolons behind the definitions of p1 and p2. Now p1 and p2 pop up and you can save them indepently. $\endgroup$
    – eldo
    Commented Jul 16, 2014 at 18:49
  • $\begingroup$ Yes :-) sorry!! $\endgroup$
    – Mika Ike
    Commented Jul 16, 2014 at 19:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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