from beakerx import *
Plot(title="test title",
xLabel="x label",
yLabel="y label")
plot1 = Plot()
plot1.add(Bars(displayName="Bar",
x=[20,40,60],
y=[100, 120, 90],
width=10))
plot2 = Plot()
plot2.add(Line(x=[1, 5, 3], y=[1, 2, 6]))
plot3 = Plot()
plot3.add(Points(y=[1, 3, 6, 3, 1],
x=[1, 2, 3, 4, 5],
size=10,
shape=ShapeType.DIAMOND))
plot4 = Plot();
plot4.add(Stems(y= [1.5, 1, 6, 5]))
plot5 = Plot(crosshair = Crosshair())
plot5.add(Area(x = [0, 1, 2, 3], y = [3, 5, 2, 3]))
Plot().add(ConstantLine(y=0.1)).add(ConstantLine(x=0.3, y=0.4, color=Color.gray, showLabel=True))
Plot().add(Line(y=[-3, 1, 3, 4, 5])).add(ConstantBand(x=[1, 2], y=[1, 3]))
from beakerx.plot import Text as BeakerxText
plot = Plot()
xs = [1, 2, 3, 4]
ys = [8.6, 6.1, 7.4, 2.5]
for i in range(0, 4):
plot.add(BeakerxText(x= xs[i], y= ys[i], text= 'test'))
plot.add(Line(x= xs, y= ys))
import pandas as pd
tableRows = pd.read_csv('../../../doc/resources/data/interest-rates.csv')
pp1 = Plot()
pp1.add(Bars(y=tableRows.y1))
pp2 = Plot()
pp2.add(Line(
x=pd.Series([10, 20, 30, 40, 50, 60, 70]),
y=pd.Series([0, 60, 10, 50, 20, 40, 30]),
width=5))
y1 = [1,5,3,2,3]
y2 = [1,2,4,1,3]
p = Plot()
a1 = Area(y=y1, displayName='y1')
a2 = Area(y=y2, displayName='y2')
stacker = XYStacker()
p.add(stacker.stack([a1, a2]))
SimpleTimePlot(tableRows, ["y1", "y10"], # column names
timeColumn="time", # time is default value for a timeColumn
displayNames=["1 Year", "10 Year"])
import time
millis = 1507541201624;
hour = round(1000 * 60 * 60);
xs = [];
ys = [];
for i in range(11):
xs.append(millis + hour * i);
ys.append(i);
plot = TimePlot(timeZone="America/New_York")
# list of milliseconds
plot.add(Points(x=xs, y=ys))
millis = millis = 1507541201624;
nanos = millis * 1000 * 1000
xs = []
ys = []
for i in range(11):
xs.append(nanos + 7 * i)
ys.append(i);
np = NanoPlot()
np.add(Points(x=xs, y=ys))
sp = Plot()
sp.add(YAxis(label= "Test y axis"))
sp.add(Line(
x=pd.Series([10, 20, 30, 40, 50, 60, 70]),
y=pd.Series([0, 60, 10, 50, 20, 40, 30])))
sp.add(Line(
x=pd.Series([5, 15, 25, 35, 45, 55, 65]),
y=pd.Series([5, 65, 15, 55, 25, 45, 35]), yAxis= "Test y axis"))
import math
points = 100;
xs = [];
for i in range(0, points):
xs.append(i)
cplot = CombinedPlot(xLabel= "CombinedPlot");
linearPlot = Plot(title= "Linear x, Linear y");
linearPlot.add(Line(x= xs, y= xs));
cplot.add(linearPlot, 3);
logYPlot = Plot(logY= True, logX=False, title= "Linear x, Log y");
logYPlot.add(Line(x= xs, y= xs));
cplot.add(logYPlot, 3);
logYPlot = Plot(logY= False, logX=True, title= "Log x, Linear y");
logYPlot.add(Line(x= xs, y= xs));
cplot.add(logYPlot, 3);
cplot