Output containers are objects that hold a collection of other objects, and displays all its contents, even when they are complex interactive objects and MIME type. By default the contents are just stacked up on the page, but you can configure them to get tabs, grid, cycling, or other layout methods.
In [ ]:
# The defining of variable doesn't initiate output
x = "some string"
In [ ]:
from beakerx import *
o = OutputContainer()
o.addItem("simplest example")
o.addItem([2, 3, 5, 7])
o.addItem(HTML("<h1>title</h1>"))
o.addItem(None)
o
In [ ]:
rates = pd.read_csv("../../../doc/resources/data/interest-rates.csv")
c = Color(120, 120, 120, 100)
plot1 = Plot(initWidth= 300, initHeight= 400)
plot1.add(Points(x= rates.y1, y=rates.y30, size= 3, displayName="y1 vs y30"))
plot1.add(Points(x= rates.m3, y=rates.y5, size= 3, displayName="m3 vs y5"))
plot1.add(Line(x= rates.y1, y=rates.y30, color= c))
plot1.add(Line(x= rates.m3, y=rates.y5, color= c))
plot1.setShowLegend(False)
plot2 = SimpleTimePlot(rates, ["m3", "y1"], showLegend=False, initWidth= 300, initHeight= 400)
plot3 = SimpleTimePlot(rates, ["y5", "y10"], showLegend=False, initWidth= 300, initHeight= 400)
table = pd.DataFrame(rates.head(n=10), columns=["m3", "y1", "y5", "y10"])
l = TabbedOutputContainerLayoutManager()
l.setBorderDisplayed(False)
o = OutputContainer()
o.setLayoutManager(l)
o.addItem(plot1, "Scatter with History")
o.addItem(plot2, "Short Term")
o.addItem(plot3, "Long Term")
o.addItem(table, "1990/01")
o
In [ ]:
plot1.setShowLegend(False)
bars = CategoryPlot(initWidth= 300, initHeight= 400)
bars.add(CategoryBars(value= [[1.1, 2.4, 3.8], [1, 3, 5]]))
lg = GridOutputContainerLayoutManager(3)
og = OutputContainer()
og.setLayoutManager(lg)
og.addItem(plot1, "Scatter with History")
og.addItem(plot2, "Short Term")
og.addItem(plot3, "Long Term1")
og.addItem(plot3, "Long Term2")
og.addItem(table, "1990/01")
og.addItem(bars, "Bar Chart")
og
In [ ]:
l = CyclingOutputContainerLayoutManager()
l.setPeriod(2000); # milliseconds
l.setBorderDisplayed(False);
o = OutputContainer()
o.setLayoutManager(l)
o.addItem(plot1, "Scatter with History")
o.addItem(plot2, "Short Term")
o.addItem(table, "1990/01")
o.addItem(plot3, "Long Term")
o
In [ ]: