Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have a very weird problem that I don't usually get. I try to plot a set of equations using LogLinearPlot and the Get coordinates right-click menuitem is working just fine. However, when I change the parameter, I right click in the image to get the coordinate, however displayed coordinate value is inconsistent with the axis. I point at around 100 to 1000 but it gives me -0.02631. This problem does not always appear and it depends on the parameters I use (ash, csh, etc.). enter image description here

Can anyone please help me what might cause this issue? I never had this problem before. I am using Mathematica v8.

I'm sorry for dumping my code. It is given because I don't know how to make it simpler.

<< "PlotLegends`"

bsh[ash_, Gs_, s0_] := ash/Gs*s0/100;
w[af_, nf_, mf_, ws_, \[Psi]_] := ws/(
     (Log[Exp[1] + (\[Psi]/af)^nf])^mf);
e[ash_, csh_, w_, Gs_, s0_] := ash*(
     ((((w/100)^csh)/(bsh[ash, Gs, s0]^csh)) + 1)^(1/csh));
s[af_, nf_, mf_, ws_, \[Psi]_, ash_, csh_, Gs_, s0_] := (
     w[af, nf, mf, ws, \[Psi]]*
     Gs/e[ash, csh, w[af, nf, mf, ws, \[Psi]], Gs, s0]);

Gs = 2.61; ws = 44.664; ll = 64; s0 = 98.373;
af = 1049; nf = 3.83; mf = 1.6; ash = 0.878; csh = 36.52;

LogLinearPlot[{
  s[af, nf, mf, ws, \[Psi], 0.9, csh, Gs, s0], 
  s[af, nf, mf, ws, \[Psi], 2*ash, csh, Gs, s0], 
  s[af, nf, mf, ws, \[Psi], ash, csh, Gs, s0], 
  s[af, nf, mf, ws, \[Psi], 0.5*ash, csh, Gs, s0], 
  s[af, nf, mf, ws, \[Psi], 0.25, csh, Gs, s0]}, 
{\[Psi], 0.01, 1000000},
 ImageSize ->400, AxesStyle -> Thick, PlotRange -> {0, 100}, 
 LabelStyle -> {Bold, 14}, AxesLabel -> {"\[Psi]", "S"}, 
 PlotLegend -> {"4ash", "2ash", "ash", "0.5ash", "0.25ash"},
 LegendPosition -> {1.1, -0.4}, LegendTextSpace -> 1,
 PlotStyle -> {Red, Thick, Dashed, Dotted, DotDashed}]
share|improve this question
2  
Could you add how you made the plot ? –  b.gatessucks Mar 23 '13 at 10:27
    
Ok. I just add it. [psi] is a esc y esc symbol. I dont know why it change into [psi] –  Martin Wijaya Mar 23 '13 at 10:47
    
My idea is that the PlotLegends package messes up the coordinates. Removing the legend-related options fixes it. Can you use the version 9 built in PlotLegends option instead of the (now obsolete) package? –  István Zachar Mar 23 '13 at 10:58
    
Ahh, I see, you are on v8. Then I guess you have to construct your own legend from scratch. –  István Zachar Mar 23 '13 at 10:59
    
Ah I see....glad to know what is the cause. Thx –  Martin Wijaya Mar 23 '13 at 11:00
add comment

1 Answer 1

In version 9 one can use the builtin PlotLegends option, but pre-9 it seems like the "PlotLegends`" package messes up coordinate display. In this case, fall back to create your own legend. For that, define styles and labels outside of the plot so that your legend can use them too.

styles = {Red, Thick, Dashed, Dotted, DotDashed};
labels = {"4ash", "2ash", "ash", "0.5ash", "0.25ash"};
legend = Panel@Grid@MapThread[{Graphics[{#1, Line@{{0, 0}, {1, 0}}}, ImageSize -> 30, 
        AspectRatio -> .3], #2} &, {styles, labels}];
Row@{
  LogLinearPlot[Evaluate[{
      s[af, nf, mf, ws, \[Psi], 0.9, csh, Gs, s0],
      s[af, nf, mf, ws, \[Psi], 2*ash, csh, Gs, s0],
      s[af, nf, mf, ws, \[Psi], ash, csh, Gs, s0],
      s[af, nf, mf, ws, \[Psi], 0.5*ash, csh, Gs, s0],
      s[af, nf, mf, ws, \[Psi], 0.25, csh, Gs, s0]} /. par],
    {\[Psi], 0.01, 1000000},
     ImageSize -> 400, AxesStyle -> Thick, LabelStyle -> {Bold, 14},
     AxesLabel -> {"\[Psi]", "S"}, PlotRange -> {0, 100}, PlotStyle -> styles],
  legend
  }

Mathematica graphics

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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