Skip to content

Commit 924878a

Browse files
committed
update cookbook
1 parent 3ea5ea5 commit 924878a

File tree

815 files changed

+51401
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

815 files changed

+51401
-1
lines changed

layouts/shortcodes/content/cookbook/5.0/.test.html

Lines changed: 1575 additions & 0 deletions
Large diffs are not rendered by default.

layouts/shortcodes/content/cookbook/5.0/API.md

Lines changed: 9942 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
Title: Annotation Customization - ScottPlot 5.0 Cookbook
3+
Description: Annotations can be extensively customized.
4+
URL: /cookbook/5.0/Annotation/AnnotationCustomize/
5+
BreadcrumbNames: ["ScottPlot 5.0 Cookbook", "Annotation", "Annotation Customization"]
6+
BreadcrumbUrls: ["/cookbook/5.0/", "/cookbook/5.0/Annotation", "/cookbook/5.0/Annotation/AnnotationCustomize"]
7+
Date: 2025-08-23
8+
Version: ScottPlot 5.0.56
9+
Version: ScottPlot 5.0.56
10+
SearchUrl: "/cookbook/5.0/search/"
11+
ShowEditLink: false
12+
---
13+
14+
15+
<div class='d-flex align-items-center mt-5'>
16+
<h1 class='me-2 text-dark my-0 border-0'>Annotation Customization</h1>
17+
</div>
18+
19+
Annotations can be extensively customized.
20+
21+
[![](/cookbook/5.0/images/AnnotationCustomize.png?250822231048)](/cookbook/5.0/images/AnnotationCustomize.png?250822231048)
22+
23+
{{< recipe-sp5 sourceUrl="https://github.com/ScottPlot/ScottPlot/blob/main/src/ScottPlot5/ScottPlot5%20Cookbook/Recipes/PlotTypes/Annotation.cs" imageUrl="/cookbook/5.0/images/AnnotationCustomize.png?250822231048" >}}ScottPlot.Plot myPlot = new();
24+
25+
myPlot.Add.Signal(Generate.Sin());
26+
myPlot.Add.Signal(Generate.Cos());
27+
28+
var anno = myPlot.Add.Annotation("Customized\nAnnotation");
29+
anno.LabelFontSize = 32;
30+
anno.LabelFontName = Fonts.Serif;
31+
anno.LabelBackgroundColor = Colors.RebeccaPurple.WithAlpha(.3);
32+
anno.LabelFontColor = Colors.RebeccaPurple;
33+
anno.LabelBorderColor = Colors.Green;
34+
anno.LabelBorderWidth = 3;
35+
anno.LabelShadowColor = Colors.Transparent;
36+
anno.OffsetY = 40;
37+
anno.OffsetX = 20;
38+
39+
myPlot.SavePng("demo.png", 400, 300);
40+
{{< /recipe-sp5 >}}
41+
42+
<div class='my-5 text-center'>This recipe is one of many in the <a href='/cookbook/5.0/Annotation'>Annotation</a> category</div>
43+
44+
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
Title: Annotation Positions - ScottPlot 5.0 Cookbook
3+
Description: Annotations are aligned with the data area.
4+
URL: /cookbook/5.0/Annotation/AnnotationPositions/
5+
BreadcrumbNames: ["ScottPlot 5.0 Cookbook", "Annotation", "Annotation Positions"]
6+
BreadcrumbUrls: ["/cookbook/5.0/", "/cookbook/5.0/Annotation", "/cookbook/5.0/Annotation/AnnotationPositions"]
7+
Date: 2025-08-23
8+
Version: ScottPlot 5.0.56
9+
Version: ScottPlot 5.0.56
10+
SearchUrl: "/cookbook/5.0/search/"
11+
ShowEditLink: false
12+
---
13+
14+
15+
<div class='d-flex align-items-center mt-5'>
16+
<h1 class='me-2 text-dark my-0 border-0'>Annotation Positions</h1>
17+
</div>
18+
19+
Annotations are aligned with the data area.
20+
21+
[![](/cookbook/5.0/images/AnnotationPositions.png?250822231048)](/cookbook/5.0/images/AnnotationPositions.png?250822231048)
22+
23+
{{< recipe-sp5 sourceUrl="https://github.com/ScottPlot/ScottPlot/blob/main/src/ScottPlot5/ScottPlot5%20Cookbook/Recipes/PlotTypes/Annotation.cs" imageUrl="/cookbook/5.0/images/AnnotationPositions.png?250822231048" >}}ScottPlot.Plot myPlot = new();
24+
25+
foreach (Alignment alignment in Enum.GetValues(typeof(Alignment)))
26+
{
27+
myPlot.Add.Annotation(alignment.ToString(), alignment);
28+
}
29+
30+
myPlot.SavePng("demo.png", 400, 300);
31+
{{< /recipe-sp5 >}}
32+
33+
<div class='my-5 text-center'>This recipe is one of many in the <a href='/cookbook/5.0/Annotation'>Annotation</a> category</div>
34+
35+
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
Title: Annotation Quickstart - ScottPlot 5.0 Cookbook
3+
Description: Annotations are labels you can place on the data area of a plot. Unlike Text added to the plot (which is placed in coordinate units on the axes), Annotations are positioned relative to the data area (in pixel units) and do not move as the plot is panned and zoomed.
4+
URL: /cookbook/5.0/Annotation/AnnotationQuickstart/
5+
BreadcrumbNames: ["ScottPlot 5.0 Cookbook", "Annotation", "Annotation Quickstart"]
6+
BreadcrumbUrls: ["/cookbook/5.0/", "/cookbook/5.0/Annotation", "/cookbook/5.0/Annotation/AnnotationQuickstart"]
7+
Date: 2025-08-23
8+
Version: ScottPlot 5.0.56
9+
Version: ScottPlot 5.0.56
10+
SearchUrl: "/cookbook/5.0/search/"
11+
ShowEditLink: false
12+
---
13+
14+
15+
<div class='d-flex align-items-center mt-5'>
16+
<h1 class='me-2 text-dark my-0 border-0'>Annotation Quickstart</h1>
17+
</div>
18+
19+
Annotations are labels you can place on the data area of a plot. Unlike Text added to the plot (which is placed in coordinate units on the axes), Annotations are positioned relative to the data area (in pixel units) and do not move as the plot is panned and zoomed.
20+
21+
[![](/cookbook/5.0/images/AnnotationQuickstart.png?250822231048)](/cookbook/5.0/images/AnnotationQuickstart.png?250822231048)
22+
23+
{{< recipe-sp5 sourceUrl="https://github.com/ScottPlot/ScottPlot/blob/main/src/ScottPlot5/ScottPlot5%20Cookbook/Recipes/PlotTypes/Annotation.cs" imageUrl="/cookbook/5.0/images/AnnotationQuickstart.png?250822231048" >}}ScottPlot.Plot myPlot = new();
24+
25+
myPlot.Add.Signal(Generate.Sin());
26+
myPlot.Add.Signal(Generate.Cos());
27+
28+
myPlot.Add.Annotation("This is an Annotation");
29+
30+
myPlot.SavePng("demo.png", 400, 300);
31+
{{< /recipe-sp5 >}}
32+
33+
<div class='my-5 text-center'>This recipe is one of many in the <a href='/cookbook/5.0/Annotation'>Annotation</a> category</div>
34+
35+
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
---
2+
Title: Annotation - ScottPlot 5.0 Cookbook
3+
Description: Annotations are always-visible text labels positioned over the data area.
4+
URL: /cookbook/5.0/Annotation/
5+
BreadcrumbNames: ["ScottPlot 5.0 Cookbook", "Annotation"]
6+
BreadcrumbUrls: ["/cookbook/5.0/", "/cookbook/5.0/Annotation"]
7+
Date: 2025-08-23
8+
Version: ScottPlot 5.0.56
9+
Version: ScottPlot 5.0.56
10+
SearchUrl: "/cookbook/5.0/search/"
11+
ShowEditLink: false
12+
---
13+
14+
<h1>Annotation</h1>
15+
16+
17+
<div class='d-flex align-items-center mt-5'>
18+
<h1 class='me-2 text-dark my-0 border-0'>Annotation Quickstart</h1>
19+
<a href='/cookbook/5.0/Annotation/AnnotationQuickstart' target='_blank'>
20+
<img src='/images/icons/new-window.svg' style='height: 2rem;' class='new-window-icon'>
21+
</a>
22+
</div>
23+
24+
Annotations are labels you can place on the data area of a plot. Unlike Text added to the plot (which is placed in coordinate units on the axes), Annotations are positioned relative to the data area (in pixel units) and do not move as the plot is panned and zoomed.
25+
26+
[![](/cookbook/5.0/images/AnnotationQuickstart.png?250822231048)](/cookbook/5.0/images/AnnotationQuickstart.png?250822231048)
27+
28+
{{< recipe-sp5 sourceUrl="https://github.com/ScottPlot/ScottPlot/blob/main/src/ScottPlot5/ScottPlot5%20Cookbook/Recipes/PlotTypes/Annotation.cs" imageUrl="/cookbook/5.0/images/AnnotationQuickstart.png?250822231048" >}}ScottPlot.Plot myPlot = new();
29+
30+
myPlot.Add.Signal(Generate.Sin());
31+
myPlot.Add.Signal(Generate.Cos());
32+
33+
myPlot.Add.Annotation("This is an Annotation");
34+
35+
myPlot.SavePng("demo.png", 400, 300);
36+
{{< /recipe-sp5 >}}
37+
38+
<hr class='my-5 invisible'>
39+
40+
41+
42+
<div class='d-flex align-items-center mt-5'>
43+
<h1 class='me-2 text-dark my-0 border-0'>Annotation Customization</h1>
44+
<a href='/cookbook/5.0/Annotation/AnnotationCustomize' target='_blank'>
45+
<img src='/images/icons/new-window.svg' style='height: 2rem;' class='new-window-icon'>
46+
</a>
47+
</div>
48+
49+
Annotations can be extensively customized.
50+
51+
[![](/cookbook/5.0/images/AnnotationCustomize.png?250822231048)](/cookbook/5.0/images/AnnotationCustomize.png?250822231048)
52+
53+
{{< recipe-sp5 sourceUrl="https://github.com/ScottPlot/ScottPlot/blob/main/src/ScottPlot5/ScottPlot5%20Cookbook/Recipes/PlotTypes/Annotation.cs" imageUrl="/cookbook/5.0/images/AnnotationCustomize.png?250822231048" >}}ScottPlot.Plot myPlot = new();
54+
55+
myPlot.Add.Signal(Generate.Sin());
56+
myPlot.Add.Signal(Generate.Cos());
57+
58+
var anno = myPlot.Add.Annotation("Customized\nAnnotation");
59+
anno.LabelFontSize = 32;
60+
anno.LabelFontName = Fonts.Serif;
61+
anno.LabelBackgroundColor = Colors.RebeccaPurple.WithAlpha(.3);
62+
anno.LabelFontColor = Colors.RebeccaPurple;
63+
anno.LabelBorderColor = Colors.Green;
64+
anno.LabelBorderWidth = 3;
65+
anno.LabelShadowColor = Colors.Transparent;
66+
anno.OffsetY = 40;
67+
anno.OffsetX = 20;
68+
69+
myPlot.SavePng("demo.png", 400, 300);
70+
{{< /recipe-sp5 >}}
71+
72+
<hr class='my-5 invisible'>
73+
74+
75+
76+
<div class='d-flex align-items-center mt-5'>
77+
<h1 class='me-2 text-dark my-0 border-0'>Annotation Positions</h1>
78+
<a href='/cookbook/5.0/Annotation/AnnotationPositions' target='_blank'>
79+
<img src='/images/icons/new-window.svg' style='height: 2rem;' class='new-window-icon'>
80+
</a>
81+
</div>
82+
83+
Annotations are aligned with the data area.
84+
85+
[![](/cookbook/5.0/images/AnnotationPositions.png?250822231048)](/cookbook/5.0/images/AnnotationPositions.png?250822231048)
86+
87+
{{< recipe-sp5 sourceUrl="https://github.com/ScottPlot/ScottPlot/blob/main/src/ScottPlot5/ScottPlot5%20Cookbook/Recipes/PlotTypes/Annotation.cs" imageUrl="/cookbook/5.0/images/AnnotationPositions.png?250822231048" >}}ScottPlot.Plot myPlot = new();
88+
89+
foreach (Alignment alignment in Enum.GetValues(typeof(Alignment)))
90+
{
91+
myPlot.Add.Annotation(alignment.ToString(), alignment);
92+
}
93+
94+
myPlot.SavePng("demo.png", 400, 300);
95+
{{< /recipe-sp5 >}}
96+
97+
<hr class='my-5 invisible'>
98+
99+
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
Title: Arrow Quickstart - ScottPlot 5.0 Cookbook
3+
Description: Arrows can be placed on plots to point to a location in coordinate space and extensively customized.
4+
URL: /cookbook/5.0/ArrowCoordinated/ArrowQuickstart/
5+
BreadcrumbNames: ["ScottPlot 5.0 Cookbook", "Arrow", "Arrow Quickstart"]
6+
BreadcrumbUrls: ["/cookbook/5.0/", "/cookbook/5.0/ArrowCoordinated", "/cookbook/5.0/ArrowCoordinated/ArrowQuickstart"]
7+
Date: 2025-08-23
8+
Version: ScottPlot 5.0.56
9+
Version: ScottPlot 5.0.56
10+
SearchUrl: "/cookbook/5.0/search/"
11+
ShowEditLink: false
12+
---
13+
14+
15+
<div class='d-flex align-items-center mt-5'>
16+
<h1 class='me-2 text-dark my-0 border-0'>Arrow Quickstart</h1>
17+
</div>
18+
19+
Arrows can be placed on plots to point to a location in coordinate space and extensively customized.
20+
21+
[![](/cookbook/5.0/images/ArrowQuickstart.png?250822231048)](/cookbook/5.0/images/ArrowQuickstart.png?250822231048)
22+
23+
{{< recipe-sp5 sourceUrl="https://github.com/ScottPlot/ScottPlot/blob/main/src/ScottPlot5/ScottPlot5%20Cookbook/Recipes/PlotTypes/Arrow.cs" imageUrl="/cookbook/5.0/images/ArrowQuickstart.png?250822231048" >}}ScottPlot.Plot myPlot = new();
24+
25+
// create a line
26+
Coordinates arrowTip = new(0, 0);
27+
Coordinates arrowBase = new(1, 1);
28+
CoordinateLine arrowLine = new(arrowBase, arrowTip);
29+
30+
// add a simple arrow
31+
myPlot.Add.Arrow(arrowLine);
32+
33+
// arrow line and fill styles can be customized
34+
var arrow2 = myPlot.Add.Arrow(arrowLine.WithDelta(1, 0));
35+
arrow2.ArrowLineColor = Colors.Red;
36+
arrow2.ArrowMinimumLength = 100;
37+
arrow2.ArrowLineColor = Colors.Black;
38+
arrow2.ArrowFillColor = Colors.Transparent;
39+
40+
// the shape of the arrowhead can be adjusted
41+
var skinny = myPlot.Add.Arrow(arrowLine.WithDelta(2, 0));
42+
skinny.ArrowFillColor = Colors.Green;
43+
skinny.ArrowLineWidth = 0;
44+
skinny.ArrowWidth = 3;
45+
skinny.ArrowheadLength = 20;
46+
skinny.ArrowheadAxisLength = 20;
47+
skinny.ArrowheadWidth = 7;
48+
49+
var fat = myPlot.Add.Arrow(arrowLine.WithDelta(3, 0));
50+
fat.ArrowFillColor = Colors.Blue;
51+
fat.ArrowLineWidth = 0;
52+
fat.ArrowWidth = 18;
53+
fat.ArrowheadLength = 20;
54+
fat.ArrowheadAxisLength = 20;
55+
fat.ArrowheadWidth = 30;
56+
57+
// offset backs the arrow away from the tip coordinate
58+
myPlot.Add.Marker(arrowLine.WithDelta(4, 0).End);
59+
var arrow4 = myPlot.Add.Arrow(arrowLine.WithDelta(4, 0));
60+
arrow4.ArrowOffset = 15;
61+
62+
myPlot.Axes.SetLimits(-1, 6, -1, 2);
63+
64+
myPlot.SavePng("demo.png", 400, 300);
65+
{{< /recipe-sp5 >}}
66+
67+
<div class='my-5 text-center'>This recipe is one of many in the <a href='/cookbook/5.0/ArrowCoordinated'>Arrow</a> category</div>
68+
69+
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
Title: Arrow - ScottPlot 5.0 Cookbook
3+
Description: Arrows point to a location in coordinate space.
4+
URL: /cookbook/5.0/ArrowCoordinated/
5+
BreadcrumbNames: ["ScottPlot 5.0 Cookbook", "Arrow"]
6+
BreadcrumbUrls: ["/cookbook/5.0/", "/cookbook/5.0/ArrowCoordinated"]
7+
Date: 2025-08-23
8+
Version: ScottPlot 5.0.56
9+
Version: ScottPlot 5.0.56
10+
SearchUrl: "/cookbook/5.0/search/"
11+
ShowEditLink: false
12+
---
13+
14+
<h1>Arrow</h1>
15+
16+
17+
<div class='d-flex align-items-center mt-5'>
18+
<h1 class='me-2 text-dark my-0 border-0'>Arrow Quickstart</h1>
19+
<a href='/cookbook/5.0/ArrowCoordinated/ArrowQuickstart' target='_blank'>
20+
<img src='/images/icons/new-window.svg' style='height: 2rem;' class='new-window-icon'>
21+
</a>
22+
</div>
23+
24+
Arrows can be placed on plots to point to a location in coordinate space and extensively customized.
25+
26+
[![](/cookbook/5.0/images/ArrowQuickstart.png?250822231048)](/cookbook/5.0/images/ArrowQuickstart.png?250822231048)
27+
28+
{{< recipe-sp5 sourceUrl="https://github.com/ScottPlot/ScottPlot/blob/main/src/ScottPlot5/ScottPlot5%20Cookbook/Recipes/PlotTypes/Arrow.cs" imageUrl="/cookbook/5.0/images/ArrowQuickstart.png?250822231048" >}}ScottPlot.Plot myPlot = new();
29+
30+
// create a line
31+
Coordinates arrowTip = new(0, 0);
32+
Coordinates arrowBase = new(1, 1);
33+
CoordinateLine arrowLine = new(arrowBase, arrowTip);
34+
35+
// add a simple arrow
36+
myPlot.Add.Arrow(arrowLine);
37+
38+
// arrow line and fill styles can be customized
39+
var arrow2 = myPlot.Add.Arrow(arrowLine.WithDelta(1, 0));
40+
arrow2.ArrowLineColor = Colors.Red;
41+
arrow2.ArrowMinimumLength = 100;
42+
arrow2.ArrowLineColor = Colors.Black;
43+
arrow2.ArrowFillColor = Colors.Transparent;
44+
45+
// the shape of the arrowhead can be adjusted
46+
var skinny = myPlot.Add.Arrow(arrowLine.WithDelta(2, 0));
47+
skinny.ArrowFillColor = Colors.Green;
48+
skinny.ArrowLineWidth = 0;
49+
skinny.ArrowWidth = 3;
50+
skinny.ArrowheadLength = 20;
51+
skinny.ArrowheadAxisLength = 20;
52+
skinny.ArrowheadWidth = 7;
53+
54+
var fat = myPlot.Add.Arrow(arrowLine.WithDelta(3, 0));
55+
fat.ArrowFillColor = Colors.Blue;
56+
fat.ArrowLineWidth = 0;
57+
fat.ArrowWidth = 18;
58+
fat.ArrowheadLength = 20;
59+
fat.ArrowheadAxisLength = 20;
60+
fat.ArrowheadWidth = 30;
61+
62+
// offset backs the arrow away from the tip coordinate
63+
myPlot.Add.Marker(arrowLine.WithDelta(4, 0).End);
64+
var arrow4 = myPlot.Add.Arrow(arrowLine.WithDelta(4, 0));
65+
arrow4.ArrowOffset = 15;
66+
67+
myPlot.Axes.SetLimits(-1, 6, -1, 2);
68+
69+
myPlot.SavePng("demo.png", 400, 300);
70+
{{< /recipe-sp5 >}}
71+
72+
<hr class='my-5 invisible'>
73+
74+

0 commit comments

Comments
 (0)