|
1 | 1 | cassius
|
2 | 2 | =======
|
3 | 3 |
|
4 |
| -Cassius is a plotting toolset for the Augustus statistical modeling package. |
| 4 | +Cassius is a plotting toolset for the Augustus statistical modeling package. |
| 5 | + |
| 6 | + |
| 7 | +The front-end (user) interface is designed to be intuitive: common tasks should be easy and all |
| 8 | +tasks should be possible. It follows the brief syntactical style of Python and, unlike many plotting |
| 9 | +toolkits, does not depend on a global state that would make copying script segments unreliable. |
| 10 | + |
| 11 | +The back-end (graphical output) interface is designed to be flexible: the primary output format is |
| 12 | +scalable SVG, which can be converted to a broad range of vector and raster formats, but other form |
| 13 | + |
| 14 | + |
| 15 | + from cassius import * |
| 16 | + |
| 17 | + # load the data |
| 18 | + dataset = inspect("wiki_Frontpage_dataset.csv") |
| 19 | + |
| 20 | + # take a quick look at it, to get familiar with the fields |
| 21 | + dataset.scan() |
| 22 | + |
| 23 | + # top_plot |
| 24 | + timeseriesX = dataset.timeseries("tx,x", linecolor="blue", |
| 25 | + informat="%m/%d/%Y-%H:%M:%S", outformat="%b %d") |
| 26 | + timeseriesX.xlabel = None |
| 27 | + timeseriesX.ylabel = "x or y" |
| 28 | + |
| 29 | + timeseriesY = dataset.timeseries("ty,y", ey="ey", limit=200, informat="%m/%d/%Y-%H:%M:%S") |
| 30 | + curveY = Curve("10*cos(x * 2*pi/(60*60*24*7)) + 30", linecolor="red") |
| 31 | + |
| 32 | + legend = Legend([["timeseriesX", timeseriesX], |
| 33 | + ["timeseriesY", timeseriesY], |
| 34 | + ["curveY", curveY]], |
| 35 | + justify="cc", width=0.3, colwid=[0.7, 0.3], x=0., y=1., anchor="tl") |
| 36 | + |
| 37 | + top_plot = Overlay(timeseriesX, timeseriesY, curveY, legend, frame=0) |
| 38 | + |
| 39 | + # bottom_left_plot |
| 40 | + categoricalHist = dataset.histogram("category", fillcolor="yellow", |
| 41 | + leftmargin=0.23, bottommargin=0.17, xlabeloffset=0.17) |
| 42 | + |
| 43 | + bottom_left_plot = Overlay(Grid(horiz=regular(200.)), categoricalHist, frame=-1) |
| 44 | + |
| 45 | + # bottom_right_plot |
| 46 | + histX = dataset.histogram("x", numbins=100, lowhigh=(15, 45), fillcolor=RGB("blue", opacity=0.5), |
| 47 | + ymax=600., rightmargin=0.1, bottommargin=0.17, xlabeloffset=0.17) |
| 48 | + histX.xlabel = "x or y" |
| 49 | + |
| 50 | + histY = dataset.histogram("y", numbins=100, lowhigh=(15, 45), fillcolor=lighten("red")) |
| 51 | + |
| 52 | + legend2 = Legend([[None, None, "mean"], |
| 53 | + [histX, "histX", str_sigfigs(histX.mean(), 3)], |
| 54 | + [histY, "histY", str_sigfigs(histY.mean(), 3)]], |
| 55 | + justify="ccr", width=0.6, colwid=[0.3, 0.4, 0.3]) |
| 56 | + |
| 57 | + bottom_right_plot = Overlay(histY, histX, legend2, frame=1) |
| 58 | + |
| 59 | + # combining everything into one image |
| 60 | + everything = Layout(2, 1, top_plot, Layout(1, 2, bottom_left_plot, bottom_right_plot)) |
| 61 | + |
| 62 | + # view(everything) |
| 63 | + draw(everything, fileName="wiki_Frontpage_output.svg") |
| 64 | + |
0 commit comments