-
Notifications
You must be signed in to change notification settings - Fork 99
Add Chart.Residual – Modified Lollipop Chart Implementation #493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ca1bab9
add Residue Chart
LibraChris ff447de
update Residual chart arguments
LibraChris 07bc582
Add Documentation for Residual Chart
LibraChris 8a1dad6
Rename to residual docs and add to solution folder
LibraChris 7c123fe
Update Legend grouping for Residual charts
LibraChris d6235fd
Update Residual Legend options
LibraChris File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
(** | ||
--- | ||
title: Residual chart | ||
category: Distribution Charts | ||
categoryindex: 5 | ||
index: 10 | ||
--- | ||
*) | ||
|
||
(*** hide ***) | ||
|
||
(*** condition: prepare ***) | ||
#r "nuget: Newtonsoft.JSON, 13.0.3" | ||
#r "nuget: DynamicObj, 7.0.1" | ||
#r "nuget: Giraffe.ViewEngine.StrongName, 2.0.0-alpha1" | ||
#r "../../src/Plotly.NET/bin/Release/netstandard2.0/Plotly.NET.dll" | ||
|
||
Plotly.NET.Defaults.DefaultDisplayOptions <- | ||
Plotly.NET.DisplayOptions.init (PlotlyJSReference = Plotly.NET.PlotlyJSReference.NoReference) | ||
|
||
(*** condition: ipynb ***) | ||
#if IPYNB | ||
#r "nuget: Plotly.NET, {{fsdocs-package-version}}" | ||
#r "nuget: Plotly.NET.Interactive, {{fsdocs-package-version}}" | ||
#endif // IPYNB | ||
|
||
(** | ||
# Residual chart | ||
|
||
[](https://mybinder.org/v2/gh/plotly/plotly.net/gh-pages?urlpath=/tree/home/jovyan/{{fsdocs-source-basename}}.ipynb)  | ||
[]({{root}}{{fsdocs-source-basename}}.ipynb) | ||
|
||
*Summary:* This example shows how to create a Residual (or Lollipop) chart in F#. | ||
|
||
Let's first create some data for the purpose of creating example charts: | ||
|
||
*) | ||
|
||
open Plotly.NET | ||
|
||
let ydata = | ||
[9.;25.;-73.;-30.;3.;35.;-35.;9.;-3.;33.;17.;25.;-15.;38.;-2.;36.;29.;-23.;15.;19] | ||
let mean = Seq.average ydata | ||
|
||
let xy = Seq.indexed ydata | ||
|
||
(** | ||
## What is a Residual (Lollipop) Chart? | ||
|
||
A Residual or Lollipop chart is a type of chart that showcases the deviation of values to a reference value, often the **mean**, **median**, or a custom threshold. | ||
|
||
- Each observation is represented by a **dot** connected to the reference line by a **line segment**. | ||
- This type of visualization is useful for identifying **patterns**, **outliers**, or **distribution skewness** in relation to a central value. | ||
- This approach is also helpful when visualizing residuals in regression models to assess **SSR (Sum of Squared Residuals)**, or highlight deviations to measures like **R²**. | ||
*) | ||
|
||
let residualChart = | ||
Chart.Residual( | ||
xy=xy, | ||
referenceValue = mean, | ||
MarkerColor = Color.fromString "purple", | ||
LineColor = Color.fromString "blue", | ||
ReferenceColor = Color.fromString "black" | ||
) | ||
|
||
(*** condition: ipynb ***) | ||
#if IPYNB | ||
residualChart | ||
#endif // IPYNB | ||
|
||
(***hide***) | ||
residualChart |> GenericChart.toChartHTML | ||
(***include-it-raw***) | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename to just "residual.fsx", as the path will then be
/distribution-charts/residual.html
on the hosted docsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, add it to the
04_distribution-charts
solution folder