Example #1
0
# ERROR BAR on XY SERIES

# source the data
t_EB = db.t("LearnDeephaven", "StockTrades")\
    .where("Date = `2017-08-23`", "USym = `GOOG`")\
    .updateView("TimeBin=upperBin(Timestamp, 20 * MINUTE)")\
    .where("isBusinessTime(TimeBin)")

# calculate standard deviations for the upper and lower error values
t_EB_StdDev = t_EB.by(
    caf.AggCombo(caf.AggAvg("AvgPrice = Last"), caf.AggStd("StdPrice = Last")),
    "TimeBin")

# plot the data
ebY_Trades = Plot.errorBarY("Trades: GOOG", t_EB_StdDev.update("AvgPriceLow = AvgPrice - StdPrice",
                                                              "AvgPriceHigh = AvgPrice + StdPrice"),
                           "TimeBin", "AvgPrice", "AvgPriceLow", "AvgPriceHigh")\
    .show()

# PLOTBY WITH PLOTSTYLE - STACKED AREA

t_pb = db.t("LearnDeephaven", "EODTrades")\
    .where("ImportDate = `2017-11-01`", "Ticker in `GOOG`,`AMZN`,`AAPL`, `MSFT`")\
    .update("DateString = EODTimestamp.toDateString(TZ_NY)")\
    .where("inRange(DateString, `2016-11-01`, `2016-12-01`)")

plotByExampleStackedArea = Plot.plotBy("TradesByDay", t_pb, "EODTimestamp", "Volume", "Ticker")\
    .chartTitle("Trades Per Day By Ticker")\
    .xLabel("Date")\
    .yLabel("Volume")\
    .plotStyle("stacked_area")\
    .show()
Example #2
0
cpBy = plt.catPlot3dBy("S1", t, "X", "X", "Y", "USym").show()

pp = plt.piePlot("S1", t, "X", "Y")

chp = plt.catHistPlot("S1", t, "X").show()

hp = plt.histPlot("S1", t, "X", 5).show()
hp = plt.histPlot("S1", t, "X", 0, 10, 5).show()

ep = plt.errorBarXY("S1", t, "X", "XLow", "XHigh", "Y", "YLow", "YHigh").show()
epBy = plt.errorBarXYBy("S1", t, "X", "XLow", "XHigh", "Y", "YLow", "YHigh",
                        "USym").show()
ep2 = plt.errorBarX("S1", t, "X", "XLow", "XHigh", "Y").show()
epBy2 = plt.errorBarXBy("S1", t, "X", "XLow", "XHigh", "Y", "USym").show()
ep3 = plt.errorBarY("S1", t, "X", "Y", "YLow", "YHigh").show()
epBy3 = plt.errorBarYBy("S1", t, "X", "Y", "YLow", "YHigh", "USym").show()

doubles = [3, 4, 3, 5, 4, 5]
time = 1491946585000000000
t = tt.newTable(tt.col("USym", ["A", "B", "A", "B", "A", "B"]),
                tt.doubleCol("Open", doubles), tt.doubleCol("High", doubles),
                tt.doubleCol("Low", doubles), tt.doubleCol("Close", doubles))

t = t.updateView("Time = new DateTime(time + (MINUTE * i))")

ohlc = plt.ohlcPlot("Test1", t, "Time", "Open", "High", "Low", "Close")

ohlcPlotBy = plt.figure().newChart(0)\
    .chartTitle("Chart Title")\
    .newAxes()\