cancel
Showing results for
Show  only  | Search instead for
Did you mean:
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
Level II

## How change "E" for powers of 10

Hello,

For a publication in a scientific paper I made graph under JMP 17 (file attached). Editor asks me to change the "E" for powers of 10. In other words, 3.4 × 10⁵ instead of 3.4e+5. Could you please tell me if there is an easy way to do this ?

best regards

Sébastien

8 REPLIES 8
Super User

Level II

## Re: How change "E" for powers of 10

Hello,

Thank you for your quick reply. Now it is like this. Do you think it is possible to adapt the formula to have this representation? 3.4 × 10⁵ ? Without the ^, but with the number in the exponent ?

Best regards

Sébastien

Super User

## Re: How change "E" for powers of 10

Try with custom format like this.

``````keys = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};
values = {"\!U2070", "\!U00B9", "\!U00B2", "\!U00B3", "\!U2074", "\!U2075", "\!U2076", "\!U2077", "\!U2078", "\!U2079"};
superscripts = Associative Array(keys, values);

valstr = Format(value, "Scientific");
exp = Word(-1, valstr, "+");
e_sup = Transform Each({e_val}, Words(exp, ""), superscripts[e_val]);
exp_superscripts = Concat Items(e_sup, "");

val = Word(1, valstr, "+");
final_val = Substitute(val, "e", "×10" || exp_superscripts);
``````

You might have to add some if statements to handle some specific situations if the format isn't correct

``````Names Default To Here(1);

dt = New Table("demo",
Compress File When Saved(1),
New Column("Column 1",
Numeric,
"Continuous",
Format("Scientific", 64),
Set Values(
[1, 10, 20, 2.5, 200, 2000, 20000, 200000, 2000000, 2000000, 20000000000,
2000000000000, 2.22222222222222e+19]
),
Set Display Width(155)
),
New Column("Column 2",
Numeric,
"Continuous",
Format(
"Custom",
Formula(
keys = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};
values = {"⁰", "¹", "²", "³", "⁴", "⁵", "⁶", "⁷", "⁸", "⁹"};
superscripts = Associative Array(keys, values);
valstr = Format(value, "Scientific");
exp = Word(-1, valstr, "+");
e_sup = Transform Each({e_val}, Words(exp, ""), superscripts[e_val]);
exp_superscripts = Concat Items(e_sup, "");
val = Word(1, valstr, "+");
final_val = Substitute(val, "e", "×10" || exp_superscripts);
),
64,
0
),
Set Values(
[1, 10, 20, 2.5, 200, 2000, 20000, 200000, 2000000, 2000000, 20000000000,
2000000000000, 2.22222222222222e+19]
),
Set Display Width(134)
)
);``````

-Jarmo
Super User

## Re: How change "E" for powers of 10

I also think it might be worth to create a wish list item for this (if there isn't one).

-Jarmo
Level II

## Re: How change "E" for powers of 10

I saw that there is a wish list dating back to 2022. As I'm a beginner, I don't understand where I should put the script you presented above.

Could you give me a step by step description or a link to learn how I can do this.

Yours faithfully

Super User

## Re: How change "E" for powers of 10

One thing my script doesn't currently take into account are negative exponents, but your data didn't seem to have those, so I didn't implement them.

Open your column properties (right click -> column info, or just double click on the header)

From format go to Custom

Then click Set Custom format. On the (formula) editor copy and paste

``````keys = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};
values = {"\!U2070", "\!U00B9", "\!U00B2", "\!U00B3", "\!U2074", "\!U2075", "\!U2076", "\!U2077", "\!U2078", "\!U2079"};
superscripts = Associative Array(keys, values);

valstr = Format(value, "Scientific");
exp = Word(-1, valstr, "+");
e_sup = Transform Each({e_val}, Words(exp, ""), superscripts[e_val]);
exp_superscripts = Concat Items(e_sup, "");

val = Word(1, valstr, "+");
final_val = Substitute(val, "e", "×10" || exp_superscripts);``````

click ok to close the editor. Then apply and OK to apply your format

-Jarmo
Level II

## Re: How change "E" for powers of 10

Thanks a lot, I copied your script in the custom section over the graphic and it works.

Have a nice day!

Super User

## Re: How change "E" for powers of 10

There is also blog postReply All: Scientific notation such as 6.02×10²³ using custom axis formats which has different custom formula which also takes the negative exponent into account. Here is my modified version of the version from the blog post by Xan (biggest change is to use Words() in Substitute Into to remove need for loop).

For scripting this can be used

``````Local({
supers = "⁰¹²³⁴⁵⁶⁷⁸⁹⁻",
numbers = "0123456789-",
numpart, exprpart
},
supers = "⁰¹²³⁴⁵⁶⁷⁸⁹⁻";
numbers = "0123456789-";
{numpart, exppart} = Words(Format(value, "Scientific", width, dec), "e+");
Substitute Into(exppart, "+", "", Words(numbers, ""), Words(supers, ""));
If(value == 0,
"0";
,
numpart || " × 10" || exppart;
);
);``````

And for easy copypaste this works (locals not used)

``````supers = "⁰¹²³⁴⁵⁶⁷⁸⁹⁻";
numbers = "0123456789-";
{numpart, exppart} = Words(Format(value, "Scientific", width, dec), "e+");
Substitute Into(exppart, "+", "", Words(numbers, ""), Words(supers, ""));
If(value == 0,
"0";
,
numpart || " × 10" || exppart;
);
``````

-Jarmo