Repository navigation
Expand file tree
/
Copy pathExampleVisibility.cs
More file actions
69 lines (65 loc) · 2.44 KB
/
Copy pathExampleVisibility.cs
File metadata and controls
69 lines (65 loc) · 2.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MatplotlibCS;
using MatplotlibCS.PlotItems;
namespace Examples.Plot2D
{
class ExampleVisibility : IExample
{
/// <summary>
/// Chart of sin
/// </summary>
public void Run(string pythonExePath, string dasPlotPyPath)
{
// init engine with right paths
var matplotlibCs = new MatplotlibCS.MatplotlibCS(pythonExePath, dasPlotPyPath);
var figure = new Figure(1, 1)
{
FileName = "ExampleVisibility1.png",
OnlySaveImage = true,
DPI = 150,
Subplots =
{
new Axes(1, "The X axis", "The Y axis")
{
Title = "Visibility",
PlotItems =
{
new Line2D("Line 1")
{
X = new List<object>() {-1, 1},
Y = new List<double>() {-1, 1},
LineStyle = LineStyle.Dashed,
Color = Color.Blue
},
new Line2D("Line 2")
{
X = new List<object>() {-1, 1},
Y = new List<double>() {-2, 2},
LineStyle = LineStyle.Solid,
Color = Color.Red,
IsVisible = false // set this line invisible for first image
},
new Point2D("plus", 0.5, -0.5)
{
Marker = Marker.Circle,
MarkerSize = 10,
Color = Color.Green,
LineWidth = 2
},
}
}
}
};
var t = matplotlibCs.BuildFigure(figure);
t.Wait();
figure.Subplots[0]["Line 2"].IsVisible = true; // now turn one line2 vivibility and build the second image with new name
figure.FileName = "ExampleVisibility2.png";
t = matplotlibCs.BuildFigure(figure);
t.Wait();
}
}
}