Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Plot fitted models together with their raw data
ResourceFunction["FittedModelPlot"][FittedModel[…]] plots the raw data and the fit described by the FittedModel[…] expression. | |
ResourceFunction["FittedModelPlot"][FittedModel[…],lims] plots the fit over the range given by lims. | |
ResourceFunction["FittedModelPlot"][{FittedModel[…],FittedModel[…]},…] plots several fit results. | |
ResourceFunction["FittedModelPlot"][{…,w[FittedModel[…],…],…},…] plots the FittedModel[…] with features defined by the symbolic wrapper w. | |
ResourceFunction["FittedModelPlot"][data,funcs,x] computes the fit from LinearModelFit[data,funcs,x]. | |
ResourceFunction["FittedModelPlot"][data,form,params,x] computes the fit from NonlinearModelFit[data,form,params,x]. | |
ResourceFunction["FittedModelPlot"][{data1,data2,…},…,x] computes the fits for several datai. | |
ResourceFunction["FittedModelPlot"][data,…,{x,xmin,xmax}] plots the fit from xmin to xmax. | |
ResourceFunction["FittedModelPlot"][{…,w[datai,…],…},…] plots datai with features defined by the symbolic wrapper w. |
"ErrorBands" | False | whether to plot the error bands of the fits |
LegendFunction | Automatic | how to generate the plot legend |
Fit data using LinearModelFit and plot the result:
In[1]:= | ![]() |
Out[3]= | ![]() |
Plot two fits:
In[4]:= | ![]() |
Out[8]= | ![]() |
Style the plot and add a legend:
In[9]:= | ![]() |
Out[13]= | ![]() |
Supply the data to FittedModelPlot directly:
In[14]:= | ![]() |
Out[16]= | ![]() |
Specify labels and callouts via wrappers, and specify that the callout should be attached to the fit line:
In[17]:= | ![]() |
Out[19]= | ![]() |
Plot the fit over a wider range:
In[20]:= | ![]() |
Out[22]= | ![]() |
With the default setting "ErrorBands"→False, no error bands are plotted:
In[23]:= | ![]() |
Out[25]= | ![]() |
Add error bands to the plot:
In[26]:= | ![]() |
Out[28]= | ![]() |
The setting for ConfidenceLevel affects the error bands:
In[29]:= | ![]() |
Out[31]= | ![]() |
With the default setting LegendFunction→Automatic, the legend is effectively generated from the PlotLegends setting:
In[32]:= | ![]() |
Out[33]= | ![]() |
Give a function to compute the legend from the FittedModel[…] expressions:
In[34]:= | ![]() |
Out[35]= | ![]() |
FittedModelPlot can be recreated using a combination of ListPlot and Plot:
In[36]:= | ![]() |
Out[38]= | ![]() |
In[39]:= | ![]() |
Out[39]= | ![]() |
Generate some noisy data for three normal distributions:
In[40]:= | ![]() |
Plot the data together with their fits:
In[41]:= | ![]() |
Out[41]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License