Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathexample2.py
More file actions
Latest commit
32 lines (28 loc) · 992 Bytes
/
Copy pathexample2.py
File metadata and controls
32 lines (28 loc) · 992 Bytes
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
importpbPlotsaspbPlots
importsupportLibassupportLib
importsys
series=pbPlots.GetDefaultScatterPlotSeriesSettings()
series.xs= [-2, -1, 0, 1, 2]
series.ys= [2, -1, -2, -1, 2]
series.linearInterpolation=True
series.lineType="dashed"
series.lineThickness=2
series.color=pbPlots.GetGray(0.3)
settings=pbPlots.GetDefaultScatterPlotSettings()
settings.width=800
settings.height=600
settings.autoBoundaries=True
settings.autoPadding=True
settings.title="x^2 - 2"
settings.xLabel="X axis"
settings.yLabel="Y axis"
settings.scatterPlotSeries= [series]
imageReference=pbPlots.CreateRGBABitmapImageReference()
errorMessage=pbPlots.StringReference()
success=pbPlots.DrawScatterPlotFromSettings(imageReference, settings, errorMessage)
ifsuccess:
pngdata=pbPlots.ConvertToPNG(imageReference.image)
supportLib.WriteToFile(pngdata, "example2.png")
pbPlots.DeleteImage(imageReference.image)
else:
sys.stderr.write("".join(errorMessage.string))