Skip to content

Updates to TicksExperimental#69

Merged
swharden merged 17 commits intoScottPlot:masterfrom
Padanian:master
Aug 9, 2019
Merged

Updates to TicksExperimental#69
swharden merged 17 commits intoScottPlot:masterfrom
Padanian:master

Conversation

@Padanian
Copy link
Contributor

@Padanian Padanian commented Aug 6, 2019

Update TicksExperimental for time domains ticks calculation. Update to console application to reflect new methods.

@swharden swharden changed the title Update to TicksExperimental for time domains ticks calculation. Updat… Updates to TicksExperimental Aug 8, 2019
autoformat, avoid extreme nested exceptions
@swharden
Copy link
Member

swharden commented Aug 8, 2019

I'm happy to merge this if you're okay with the change

@swharden
Copy link
Member

swharden commented Aug 9, 2019

@Padanian
Copy link
Contributor Author

Padanian commented Aug 9, 2019

This is progressing really well! I just modified Ticks.cs and added a bool we can change to experiment with the new and old tick systems:

It's more than possibly a bug, but I need to test it after pulling. I'll see what's the problem.

@Padanian
Copy link
Contributor Author

Padanian commented Aug 9, 2019

I am unable to reproduce. Works for me. Are you up with all commits?

@swharden
Copy link
Member

swharden commented Aug 9, 2019

I created a new "tick tester 2" winForms app in /demos/

The "Large" button reproduces this error

image

@swharden
Copy link
Member

swharden commented Aug 9, 2019

I modified the console application to reproduce this error

double bigNumber = Math.Pow(23.456, 9);
double smallNumber = Math.Pow(23.456, -9);

DisplayTicksForRange(-bigNumber, bigNumber);
DisplayTicksForRange(9876 * bigNumber, 9877 * bigNumber);
DisplayTicksForRange(-smallNumber, smallNumber);
DisplayTicksForRange(9876 * smallNumber, 9877 * smallNumber);
Value range: [-2149243275732, 2149243275732]
  tick labels: -166666666666.667  -83333333333.333  0  83333333333.333  166666666666.667  
  modifier: x10¹²

Value range: [2.12259265911293E+16, 2.1228075834405E+16]
  tick labels: 0  31250000000  62500000000  93750000000  125000000000  
  modifier: x10¹62.123x10¹6

Value range: [-4.65280041255177E-13, 4.65280041255177E-13]
  tick labels: NaN  8  8  
  modifier: -2.5E-13

Value range: [4.59510568743613E-09, 4.59557096747739E-09]
  tick labels: 4.595  4.595  4.595  4.596  
  modifier: x10??

@Padanian
Copy link
Contributor Author

Padanian commented Aug 9, 2019

The bug is on line 96

https://github.com/swharden/ScottPlot/blob/be1d2866f014b5fc1a20b9e72d5496ec80ce5f76/src/ScottPlot/TicksExperimental.cs#L96

which should read:
if (Exponents.Max() != Exponents.Min() & Exponents.Min() !=0 )

For simmetrical plots, the Exponents.Min is 0.

@swharden
Copy link
Member

swharden commented Aug 9, 2019

Edit: I made the change you suggested cfa8790

This is much better! However, a few issues remain:

Value range: [-2149243275732, 2149243275732]
  tick labels: -2  -1  0  1  2  
  modifier: x10¹²

Value range: [2.12259265911293E+16, 2.1228075834405E+16]
  tick labels: 0  31250000000  62500000000  93750000000  125000000000  
  modifier: x10¹62.123x10¹6

Value range: [-4.65280041255177E-13, 4.65280041255177E-13]
  tick labels: NaN  8  8  
  modifier: -2.5E-13

Value range: [4.59510568743613E-09, 4.59557096747739E-09]
  tick labels: 4.595  4.595  4.595  4.596  
  modifier: x10??

@Padanian
Copy link
Contributor Author

Padanian commented Aug 9, 2019

Line 100 should read:
tickPositionsMantissas[i] = Math.Round((tickPositions[i]) / Math.Pow(10,tickPositionsExponent), 3);

@swharden
Copy link
Member

swharden commented Aug 9, 2019

I made the change you suggested. It now looks like:

https://github.com/swharden/ScottPlot/blob/2bb4e3c67ecf412745fc1746d4a520cb05e65951/src/ScottPlot/TicksExperimental.cs#L96-L104

Value range: [-2149243275732, 2149243275732]
  tick labels: -2  -1  0  1  2  
  modifier: x10¹²

Value range: [2.12259265911293E+16, 2.1228075834405E+16]
  tick labels: 0  31250000000  62500000000  93750000000  125000000000  
  modifier: x10¹62.123x10¹6

Value range: [-4.65280041255177E-13, 4.65280041255177E-13]
  tick labels: NaN  8  8  
  modifier: -2.5E-13

Value range: [4.59510568743613E-09, 4.59557096747739E-09]
  tick labels: 4.595  4.595  4.595  4.596  
  modifier: x10??

@Padanian
Copy link
Contributor Author

Padanian commented Aug 9, 2019

And line 119 shall have the same correction of line 100

@Padanian
Copy link
Contributor Author

Padanian commented Aug 9, 2019

there is still one bug on line 109 to be sorted out.

@swharden
Copy link
Member

swharden commented Aug 9, 2019

I made the update but the output is the same.

I know you're going on holiday soon! I don't want to disturb you when you leave. If you're still available, it might be more effective for you to make code changes to this pull request and I can merge it once it's working well. If you've left already, let me know I'll keep working on this and not trouble you about it!

This is the current mantissa-generating function:
https://github.com/swharden/ScottPlot/blob/dc059105046d30d35de7297ddd844c07f8ee35ef/src/ScottPlot/TicksExperimental.cs#L74-L128

@Padanian
Copy link
Contributor Author

Padanian commented Aug 9, 2019

There's one remaining bug, when Max and Min are of the same order of magnitude and they require exponentiation. It is a recursion of the same scenario. I'll see into it when I'm back.

@swharden
Copy link
Member

swharden commented Aug 9, 2019

This works great now, thanks so much @Padanian!

I'll pull it into the main branch and continue to work on it a bit there.

@swharden swharden merged commit 68dfd31 into ScottPlot:master Aug 9, 2019
StendProg pushed a commit to StendProg/ScottPlot that referenced this pull request Mar 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants