Axes Numerical Ticks in Exponential Form not Formatting Properly in Log Scale
See original GitHub issueGreat library! Just hit the problem below when creating a log-log plot that seems to be due to how the tick labels are constructed.
Here’s a minimal example to reproduce the issue:
import plotext as plt
plt.xscale("log")
plt.yscale("log")
plt.plot(
[3.66070161e-08, 4.70771327e-07, 6.13046022e-07, 9.78958201e-01,
9.97156618e-01, 1.00000000e+00],
[5.60983465e-12, 5.07770834e-11, 6.79463166e-11, 5.34865283e-01,
8.23871623e-01, 9.99762833e-01]
)
plt.show()
This causes:
File "...site-packages/plotext/_monitor.py", line 1153, in <listcomp>
labels = [el[: el.index('.') + d + 2] for el in labels]
ValueError: substring not found
The value of labels
at that point is:
['1e-11', '4.2e-10', '3.157e-08', '2.36823e-06', '0.00017765659999999998', '0.013327207709999999', '0.9997628329999999']
and there is no decimal point in the first label. distinguishing_digit()
might also be returning too many digits in this case.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Matplotlib log scale tick label number formatting - Stack Overflow
To change the formatter to the default for linear axes ( ScalarFormatter ) use e.g. What if I wanted to change the numbers...
Read more >Creating Exponential Notation Axis Labels - Peltier Tech
The first step is to hide the built in axis labels. Double click on one axis, select the Patterns tab, and select None...
Read more >1.11 FAQ-122 How do I format the axis tick labels? - OriginLab
Change Numeric Tick Label Display. Double click on the axis tick labels or select Format: Axes: X/Y/Z Axis... menu go to Tick Labels...
Read more >Format axes Tick Labels in log scale - MATLAB Answers
Dear all, an annoying issue when plotting on log scales, is apparently not being able to control the format of axis tick labels....
Read more >Syntax: PROC SGPANEL COLAXIS Statement - SAS Help Center
specifies how to scale and format the values for the major tick marks for logarithmic axes. LOGVTYPE=EXPANDED | EXPONENT. specifies the scale ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Quick fix:
Regards! 🙂
Great Issue report, thanks a lot. I will have a look at it. Kind of resting a bit after latest upload (it was a big work).