Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #7585
| From | "Scot T. Martin" <smartin@seas.harvard.edu> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Frameticks and ListLogLinearPlot |
| Date | 2012-01-05 10:56 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <je3vku$eaf$1@smc.vnet.net> (permalink) |
| References | <201201041006.FAA03473@smc.vnet.net> |
Luigi, some things that you think should be simple are in fact hard in Mathematica. Below is an example you can adapt to your own problem. This code would be called with an example like: FrameTicks -> {tickFunction[0, 500, "Style" -> Integer], tickFunction[0, 6, "Style" -> Decimal], {}, {}}:
In[1]:= Options[tickFunction] = {"Style" -> Automatic}
Out[1]= {"Style" -> Automatic}
In[2]:= Options[tickLabelStyleFunction] = {"Style" -> Automatic}
Out[2]= {"Style" -> Automatic}
In[3]:= tickLabelStyleFunction[value : _, opts : OptionsPattern[]] :=
Switch[
OptionValue["Style"],
Automatic,
value,
Integer,
IntegerPart[value],
Decimal,
NumberForm[value, {2, 1}]
]
In[4]:= tickFunction[start : _, stop : _, opts : OptionsPattern[]] :=
Map[
Function[
value,
{value,
tickLabelStyleFunction[value,
FilterRules[{opts}, Options[tickLabelStyleFunction]]],
{0, 0.02},
{Directive[Thickness[0.005]]}
}
],
N@FindDivisions[{start, stop}, 5]
]
________________________________________
From: Luigi B [l.balzano@gmail.com]
Sent: Wednesday, January 04, 2012 05:06
Subject: Frameticks and ListLogLinearPlot
Dear all,
I have the problem of adding ticks to a ListLogLinearPlot.
I use the code:
data = {{10^(-6), 72}, {10^(-5), 60}, {10^(-4), 45}, {10^(-3),
31}, {10^(-2), 33}, {10^(-1), 32}};
ListLogLinearPlot[data, Frame -> True,
FrameTicks -> {Table[{10^-n,
ScientificForm[1.*10^(-n), NumberFormat -> (10^#3&)]}, {n,
-1,6}],
Automatic, Automatic, None}, PlotRange -> {0, 100}]
this works well as long as the mantissa of the tick is different than
0. However, when this happens it does not work any more.
Could you pls help me out? Or suggest another code to do the same?
Thanks, Luigi
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: Frameticks and ListLogLinearPlot "Scot T. Martin" <smartin@seas.harvard.edu> - 2012-01-05 10:56 +0000
csiph-web