{ "cells": [ { "cell_type": "markdown", "id": "cd6ed382-76f2-4d90-ab8c-a09d18681822", "metadata": {}, "source": [ "# Working With Scientific Notation\n", "\n", "The `exponent_format` parameter in the `theme(...)` function can be used to configure the way \"exponent notation\" looks like on plot.\n", "\n", "Available values:\n", "\n", "- `'e'` for \"e\" notation (e.g. 1e+6);\n", "- `'pow_full'` for \"power\" notation (e.g. $1 \\cdot 10^6$). This will enable superscript formatting for the exponent;\n", "- `'pow'` works as `'pow_full'` but will shorten powers of 10 (e.g. $10^6$ instead of $1 \\cdot 10^6$).\n", "\n", "The \"exponent format\" is automatically applied to each value formatted in scientific notation, regardless whether the format is user-defined or chosen automatically based on the data. This format affects every part of a plot, including geoms, scales, labels, and tooltips.\n", "\n", "> **Note**\n", "> \n", "> Superscript is not supported when exporting to PNG/PDF." ] }, { "cell_type": "code", "execution_count": 1, "id": "440ed621-4a10-4f0a-8f39-36f05afb56b5", "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "\n", "from lets_plot import *" ] }, { "cell_type": "code", "execution_count": 2, "id": "f4564dc9-f210-4d74-8f7c-04eacaca2b4d", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "
\n", " \n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "LetsPlot.setup_html()" ] }, { "cell_type": "code", "execution_count": 3, "id": "b9028a79-4879-4537-a0e0-a5d78aa07de6", "metadata": {}, "outputs": [], "source": [ "amu_coeff_ng = 1.6605402 * 10**(-15)" ] }, { "cell_type": "code", "execution_count": 4, "id": "52633b78-510f-4769-9a97-e297d43fbb66", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "(118, 5)\n" ] }, { "data": { "text/html": [ "| \n", " | Name | \n", "Symbol | \n", "Type | \n", "Weight (ng) | \n", "Radius | \n", "
|---|---|---|---|---|---|
| 0 | \n", "Hydrogen | \n", "H | \n", "Nonmetal | \n", "1.673725e-15 | \n", "0.79 | \n", "
| 1 | \n", "Helium | \n", "He | \n", "Noble Gas | \n", "6.646482e-15 | \n", "0.49 | \n", "
| 2 | \n", "Lithium | \n", "Li | \n", "Alkali Metal | \n", "1.152581e-14 | \n", "2.10 | \n", "
| 3 | \n", "Beryllium | \n", "Be | \n", "Alkaline Earth Metal | \n", "1.496509e-14 | \n", "1.40 | \n", "
| 4 | \n", "Boron | \n", "B | \n", "Metalloid | \n", "1.795210e-14 | \n", "1.20 | \n", "