Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

L = 1; ϕ = 1 Pi/180; KL = 1; KT = 1;

plot1 = Plot[(4*(-θ+ϕ)*KT+L^2/Cos[θ]*(1/Cos[ϕ]-1/Cos[θ])*KL*Tan[θ])/(L*(1/Cos[θ])^2), 
             {θ, -ϕ, ϕ }]

plot2 = Plot[-1/(2*L)*Cos[θ]^2*1/    Tan[θ]*(4*KT + KL*L^2*(1/Cos[θ])^2 - 
             KL*L^2*(1/Cos[θ])^3*1/Cos[ϕ] + 2*KL*L^2*(1/Cos[θ])^2*Tan[θ]^2 - 
             {θ, -ϕ, ϕ},    PlotRange -> Automatic]

Show[plot1, plot2, PlotRange -> Automatic]

As shown I can plot functions seperately and then use Show to plot them in one graph. The reason I do not get a good picture is because of different plot ranges. How could I change this?


share|improve this question

marked as duplicate by Yves Klett, Simon Woods, Kuba, m_goldberg, Sjoerd C. de Vries May 12 '14 at 13:35

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

From Mathematica Documentation when searching for two axis plot (and this Q&A):

TwoAxisPlot[{f_, g_}, {x_, x1_, x2_}] := 
  Module[{fgraph, ggraph, frange, grange, fticks, gticks}, 
  {fgraph, ggraph} = MapIndexed[
    Plot[#, {x, x1, x2}, Axes -> True, 
    PlotStyle -> ColorData[1][#2[[1]]]] &, {f, g}];
  {frange, grange} = 
    (PlotRange /. AbsoluteOptions[#, PlotRange])[[2]] & /@ {fgraph, ggraph};
  (* small change here to have more ticks *) 
  fticks = N@FindDivisions[frange, 10]; 
  gticks = Quiet@Transpose@{fticks,ToString[NumberForm[#, 2], StandardForm] & /@
    Rescale[fticks, frange, grange]}; 

  Show[fgraph, ggraph /. 
    Graphics[graph_, s___] :> 
      Graphics[GeometricTransformation[graph, RescalingTransform[{{0, 1}, grange}, {{0, 1}, frange}]], s], 
    Axes -> False, Frame -> True, 
    FrameStyle -> {ColorData[1] /@ {1, 2}, {Automatic, Automatic}}, 
    FrameTicks -> {{fticks, gticks}, {Automatic, Automatic}}]]

Applying this to your case:

L = 1; ϕ = 1 Pi/180; KL = 1; KT = 1;
fun[θ_] := (4*(-θ + ϕ)*KT + L^2/Cos[θ]*(1/Cos[ϕ] - 1/Cos[θ])*KL*Tan[θ])/(L*(1/Cos[θ])^2)
fun2[θ_] := -1/(2*L)*Cos[θ]^2*1/Tan[θ]*(4*KT + KL*L^2*(1/Cos[θ])^2 - 
  KL*L^2*(1/Cos[θ])^3*1/Cos[ϕ] + 2*KL*L^2*(1/Cos[θ])^2*Tan[θ]^2 - 

TwoAxisPlot[{fun@θ, fun2@θ}, {θ, -ϕ, ϕ}]

enter image description here

share|improve this answer

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