Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #6661 > unrolled thread

Aligning 2 Sets of Axes at {0,0}; Rotated & Standard Position

Started byBill <WDWNORWALK@aol.com>
First post2011-11-23 12:15 +0000
Last post2011-11-24 12:06 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Aligning 2 Sets of Axes at {0,0}; Rotated & Standard Position Bill <WDWNORWALK@aol.com> - 2011-11-23 12:15 +0000
    Re: Aligning 2 Sets of Axes at {0,0}; Rotated & Standard Position Peter Pein <petsie@dordos.net> - 2011-11-24 12:06 +0000

#6661 — Aligning 2 Sets of Axes at {0,0}; Rotated & Standard Position

FromBill <WDWNORWALK@aol.com>
Date2011-11-23 12:15 +0000
SubjectAligning 2 Sets of Axes at {0,0}; Rotated & Standard Position
Message-ID<jaio5e$epq$1@smc.vnet.net>
Subj: Aligning Two Sets of Axes at {0,0}; Rotated and Standard Position in one plot.


Hi:

I have the following Mathematica 8.0.4 code that gives me a satisfactory plot:

a=17;b=-48;c=31;
(ArcTan[b/(a-c)])/2;
N[(%)*(180/Pi)];
Print["Majoraxis: Angle in Decimal Degrees= ",%]
axes=Graphics[Point[{0,0}],PlotRange->{{-12,12},{-12,12}},Axes->True,AxesStyle->{Directive[{Red,Thin}],Directive[{Black,Thin}]},AxesLabel->{"'x","'y"},AspectRatio->1,ImageSize->500];
ContourPlot[17*x^2-48*x*y+31*y^2+49==0,{x,-12,12},{y,-12,12},AspectRatio->1,Axes->True,AxesStyle->{Directive[{Red,Thin}],Directive[{Black,Thin}]},AxesLabel->{"X","Y"},Background->LightGray,ImageSize->500,Prolog->Inset[Rotate[Graphics[axes],36.8699Degree],{.1,.7}]]

However, my objective here is to combine the two plots with the two sets of axes centered automatically.
As my code is now, I have to use a trial-and-error visual inspection method, and manually input the location of the rotated axes to match the main plot axes' center at standard position.
 
Ref: See {.1,.7} in ...Inset[Rotate[Graphics[axes],36.8699Degree],{.1,.7}]] 
(In another example using another equation that I ploted, the alignment values were different yet. So for some reason, these numbers don't seem to be constants from one plot to another.)

I have tried AxesOrigin->{0,0} in the plots, but this doesn't seem to matter. Any help will be appreciated.


Tia,

Bill

[toc] | [next] | [standalone]


#6693

FromPeter Pein <petsie@dordos.net>
Date2011-11-24 12:06 +0000
Message-ID<jalbvh$sjn$1@smc.vnet.net>
In reply to#6661
Am 23.11.2011 13:15, schrieb Bill:
> Subj: Aligning Two Sets of Axes at {0,0}; Rotated and Standard Position in one plot.
> 
> 
> Hi:
> 
> I have the following Mathematica 8.0.4 code that gives me a satisfactory plot:
> 
> a=17;b=-48;c=31;
> (ArcTan[b/(a-c)])/2;
> N[(%)*(180/Pi)];
> Print["Majoraxis: Angle in Decimal Degrees= ",%]
> axes=Graphics[Point[{0,0}],PlotRange->{{-12,12},{-12,12}},Axes->True,AxesStyle->{Directive[{Red,Thin}],Directive[{Black,Thin}]},AxesLabel->{"'x","'y"},AspectRatio->1,ImageSize->500];
> ContourPlot[17*x^2-48*x*y+31*y^2+49==0,{x,-12,12},{y,-12,12},AspectRatio->1,Axes->True,AxesStyle->{Directive[{Red,Thin}],Directive[{Black,Thin}]},AxesLabel->{"X","Y"},Background->LightGray,ImageSize->500,Prolog->Inset[Rotate[Graphics[axes],36.8699Degree],{.1,.7}]]
> 
> However, my objective here is to combine the two plots with the two sets of axes centered automatically.
> As my code is now, I have to use a trial-and-error visual inspection method, and manually input the location of the rotated axes to match the main plot axes' center at standard position.
>  
> Ref: See {.1,.7} in ...Inset[Rotate[Graphics[axes],36.8699Degree],{.1,.7}]] 
> (In another example using another equation that I ploted, the alignment values were different yet. So for some reason, these numbers don't seem to be constants from one plot to another.)
> 
> I have tried AxesOrigin->{0,0} in the plots, but this doesn't seem to matter. Any help will be appreciated.
> 
> 
> Tia,
> 
> Bill
> 

Hi Bill!

Phew! This one was a lot of trial and error here.
I changed:

1.) Omitted the conversion of the angle to degree and back to radians
and moved the axes-related Options out of Graphics[]
2.) I use the rotation and translation inside Inset
3.) became finally aware that it seems to be necessary that the axes
Graphics and the ContourPlot have got the same ImagePadding.

And I added a grey circle to verify that the axes in the plot and in the
inset are of same length.

a = 17; b = -48; c = 31;
alpha = ArcTan[b/(a - c)]/2;
axes = Show[Graphics[Point[{0, 0}]],
 PlotRange -> {{-12, 12}, {-12, 12}}, Axes -> True,
 AxesStyle -> {Directive[{Red, Thin}], Directive[{Black, Thin}]},
 AxesLabel -> {"'x", "'y"}, ImagePadding -> 20];
ContourPlot[17*x^2 - 48*x*y + 31*y^2 + 49 == 0,
 {x, -12, 12}, {y, -12, 12}, PlotRange -> {{-12, 12}, {-12, 12}},
 AspectRatio -> Automatic, Axes -> True,
 AxesStyle -> {Directive[{Red, Thin}], Directive[{Black, Thin}]},
 AxesLabel -> {"X", "Y"}, Background -> LightGray,
 Prolog -> {GrayLevel[0.7], AbsoluteThickness[1], Circle[{0, 0}, 12],
  Inset[axes, {0, 0}, {0, 0}, ImageScaled[1],
   Through[{Cos, Sin}[alpha]]]},
 ImageSize -> 500, ImagePadding -> 20]


hth,

  Peter

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web