import
numpy as np
x
=
np.random.randn(
1000
)
y
=
np.random.randn(
1000
)
from
py4j.java_gateway
import
JavaGateway
gateway
=
JavaGateway(auto_convert
=
True
)
WPlot
=
gateway.jvm.kcl.waterloo.plot.WPlot
p
=
WPlot.scatter([
'xData'
, x,
'yData'
, y,
'marker'
,
'.'
])
f
=
p.createFrame()
f.getGraphicsContainer().getGrid().add(p.getPlot().getParentGraph().getGraphContainer(),
2.
,
0.
,
5.
,
5.
)
g1
=
gateway.jvm.kcl.waterloo.graphics.GJGraphContainer.createInstance( \
gateway.jvm.kcl.waterloo.graphics.GJGraph.createInstance())
h1
=
np.histogram(x, density
=
True
)
p2
=
WPlot.bar([
'xData'
, np.arange(
0
,
len
(h1[
0
])),
'yData'
, h1[
0
], \
'mode'
, gateway.jvm.kcl.waterloo.graphics.plots2D.BarExtra.MODE.HISTC])
g1.getView().add(p2.getPlot())
g1.getView().setAxesBounds(
0.
,
0.
,
10.
,
0.55
)
f.add(g1,
0.
,
0.
,
5.
,
2.
,
0
)
g2
=
gateway.jvm.kcl.waterloo.graphics.GJGraphContainer.createInstance( \
gateway.jvm.kcl.waterloo.graphics.GJGraph.createInstance())
h2
=
np.histogram(y, density
=
True
)
p3
=
WPlot.bar([
'xData'
, np.arange(
0
,
len
(h2[
0
])),
'yData'
, h2[
0
], \
'mode'
, gateway.jvm.kcl.waterloo.graphics.plots2D.BarExtra.MODE.HISTC, \
'orientation'
,
'horizontal'
])
g2.getView().add(p3.getPlot())
g2.getView().setAxesBounds(
0.
,
0.
,
0.55
,
10.0
)
f.add(g2,
2.
,
5.
,
2.
,
5.
,
0
)
f.setAlwaysOnTop(
True
)
WPlot
=
None