LogLinearPlot issues [closed]

I am currently fighting with certain LogLinearPlot shenanigans.

You can see:

Term reordering in the PlotLegends.
No colors for the plot legends (the graphs themselves have them)
Weird ‘cutoff’ in the graph for one of the functions
An error

“An unknown box name (Superscript) was sent as the BoxForm for the expression. Check the format rules for the expression.”

in the messages window for {N, 1, 10000} as parameter range. (The error vanishes for {N, 1, 1000}, but it doesn’t seem to affect the other issues)

Can someone give me some hints as to what is going on, how to figure out the weird error 4, and how to fix the other things as well? Using Plot instead of LogLinearPlot does not exhibit any of these issues.

=================

=================

1 Answer
1

=================

There are two issues here:

Issue 1: Use of capital N

This is a common problem — don’t use N or any other built-in symbol as the name of a variable. I changed it to x (you have f(x) in there somewhere, so I figured I’d keep that x) and got a perfectly normal plot from:

LogLinearPlot[
{x^3/6 – x/6, x^3}, {x, 1, 10^5},
PlotLegends -> “Expressions”, AxesLabel -> {“x”, “f(x)”}
]

Issue 2: Plot Labels

This issue appears to be present only in older versions of Mathematica. I’m on 10.2 and the plot legends come out as you desire by default. I believe that would qualify as either a “bug” or “missing feature” (depending on how you look at it) that has been corrected. (Based on the colors in your screen-shot, I assume you’re using an older version.)

  

 

Yea, as bill-s pointed out in one of the comments, the problems (2)-(4) came from using N as the parameter name. Interestingly, Plot doesn’t exhibit this behaviour and correctly treats N as parameter. Even the syntax parser seems to be aware of the difference in context (via coloring in the editor). The last remaining issue is clearly a bug (I’m on Mathematica 9): For all i care LogLinearPlot could be using 1/6 (-x + x^2) (1 + x) as internal representation for evaluation, however when PlotLegends are to be the input “Expressions”, I expect the original input expression to show up.
– MrCC
Jan 26 at 14:38

  

 

It probably has to do with how LogLinearPlot handles its input. It may have to be a bit more careful about having huge values in the logarithmic variable. I can only imagine LogLinearPlot does something, then passes that something to Plot — the pre-processing before that hand-off is where it fudges some of the parameters on the way through.
– Kellen Myers
Jan 27 at 5:07