High Accuracy Plotting Julia

73 Views Asked by At

I need to plot a vector to check the smoothness after a time step. I am using BigFloats for my calculations as I need around 30 significant figures of precision. However when I plot the curve it produces straight lines and a step-like function rather than the smooth exponetial expected. enter image description here

The following is a snippet of the line that is part of a step: BigFloat[100.0000000000000415218052481750617286013320903044045041396609898380148595444762, 100.0000000000000388265628899099514341100382204524156891968983697369426488798809, 100.0000000000000363062727363085762292325632186834493337517224584792054527723356, 100.0000000000000339495783786150261012296921512433605812091199343376652161950677, 100.0000000000000317458605695174505228098510722911315751354700135345534031890935, 100.000000000000029685189372898363532482287162646902602289813876155120000265496, 100.0000000000000277582794196160825883609682726800727787249223580582615164937514, 100.0000000000000259564480677001839289595896200349651337934245121726075948266956, 100.0000000000000242715762784311252101907139102143032081235394837893837883955368, 100.0000000000000226960720320119401198918779256182953401953801932430097596985907, 100.0000000000000212228361179832927282805903123784250581905172324680939364646929]

I have tried using Makie, Plots and Plotly with no real success. I am new to Julia in general so maybe there is a setting in one of those I could set as I have been running basic plot(x,y) commands to plot the curves. The vector above clearly decreases with each value so I should be seeing that in the plot

1

There are 1 best solutions below

0
max xilian On

A plot of discrete data points will always be just that: a plot of discrete data points, no matter what's their precision. Plots.jl will connect each data point with a line per default. Some other plotting libraries do a spline interpolation between points optionally or some maybe also per default. This interpolation will appear to be smooth, but it is just a data-driven interpolation. If you want one, you can use DataInterpolations.jl for that. It does include plotting recipes for Plots.jl.

What exactly do you mean by "check the smoothness after a time step" and how exactly do you plan to do that? You shouldn't rely on graphical methods for this.

If you want to check your data for smoothness, it is probably better to set a treshold for maximum(diff(data)) < threshold (or a rescaled version) or look into more advanced ways to numerically ensure smoothness, e.g. by using finite difference approximations of the derivative of the data with FiniteDifferences.jl.