Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jetty update #3

Merged
merged 7 commits into from
Nov 16, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ To clone this repo and get started, run:
```
git clone https://github.com/deephaven-examples/deephaven-matplotlib-base.git
cd deephaven-matplotlib-base
docker-compose pull
docker-compose up --build -d
docker compose pull
docker compose up --build -d
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a line at the bottom of the README that we should remove since we removed the examples:

The 3D examples in this readme are from Rashida Nasrin Sucky the data is available from kaggle

```

This starts the Deephaven IDE with all the needed packages.
Expand Down
12 changes: 0 additions & 12 deletions data/notebooks/1example.py

This file was deleted.

26 changes: 0 additions & 26 deletions data/notebooks/4example_3d_bar.py

This file was deleted.

183 changes: 183 additions & 0 deletions data/storage/layouts/layout.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
{
"layoutConfig": [
{
"type": "column",
"isClosable": true,
"isFocusOnShow": true,
"reorderEnabled": true,
"title": "",
"content": [
{
"type": "row",
"isClosable": true,
"isFocusOnShow": true,
"reorderEnabled": true,
"title": "",
"height": 54.54545454545454,
"content": [
{
"type": "stack",
"isClosable": true,
"isFocusOnShow": true,
"reorderEnabled": true,
"title": "",
"width": 47.37762237762238,
"activeItemIndex": 0,
"height": 100,
"content": [
{
"type": "react-component",
"component": "ConsolePanel",
"title": "Console",
"isClosable": false,
"id": "erpozSH5iO",
"props": {
"metadata": {},
"panelState": {
"consoleSettings": {},
"itemIds": [
[
"m_figure",
"s12lxgm2M"
],
[
"figure",
"Ek9z6L6Ch"
]
]
}
},
"componentName": "lm-react-component",
"isFocusOnShow": true,
"reorderEnabled": true,
"componentState": null
},
{
"type": "react-component",
"component": "LogPanel",
"title": "Log",
"isClosable": false,
"id": "DMV2y0zEMY",
"props": {
"metadata": {}
},
"componentName": "lm-react-component",
"isFocusOnShow": true,
"reorderEnabled": true,
"componentState": null
}
]
},
{
"type": "stack",
"width": 52.62237762237763,
"isClosable": true,
"isFocusOnShow": true,
"reorderEnabled": true,
"title": "",
"activeItemIndex": 1,
"content": [
{
"type": "react-component",
"component": "CommandHistoryPanel",
"title": "Command History",
"isClosable": false,
"id": "i0ww9QktWa",
"props": {
"metadata": {},
"panelState": {}
},
"componentName": "lm-react-component",
"isFocusOnShow": true,
"reorderEnabled": true,
"componentState": null
},
{
"type": "react-component",
"component": "FileExplorerPanel",
"title": "File Explorer",
"isClosable": false,
"id": "h7nN4VTULl",
"props": {
"metadata": {}
},
"componentName": "lm-react-component",
"isFocusOnShow": true,
"reorderEnabled": true,
"componentState": null
}
]
}
]
},
{
"type": "stack",
"isClosable": true,
"isFocusOnShow": true,
"reorderEnabled": true,
"title": "",
"height": 45.45454545454545,
"activeItemIndex": 0,
"width": 100,
"content": [
{
"type": "react-component",
"component": "NotebookPanel",
"isFocusOnShow": false,
"props": {
"metadata": {
"id": "P1528kRW9"
},
"panelState": {
"settings": {
"value": null,
"language": "python"
},
"fileMetadata": {
"id": "/1_example.py",
"itemName": "/1_example.py"
},
"isPreview": true
}
},
"title": "1_example.py",
"id": "P1528kRW9",
"componentName": "lm-react-component",
"isClosable": true,
"reorderEnabled": true,
"componentState": null
},
{
"type": "react-component",
"component": "NotebookPanel",
"isFocusOnShow": false,
"props": {
"metadata": {
"id": "Repm9hXXd"
},
"panelState": {
"settings": {
"value": null,
"language": "python"
},
"fileMetadata": {
"id": "/2_example.py",
"itemName": "/2_example.py"
},
"isPreview": true
}
},
"title": "2_example.py",
"id": "Repm9hXXd",
"componentName": "lm-react-component",
"isClosable": true,
"reorderEnabled": true,
"componentState": null
}
]
}
]
}
],
"version": 2
}
12 changes: 12 additions & 0 deletions data/storage/notebooks/1_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import matplotlib.pyplot as plt

plt.figure()
x = [0, 2, 4, 6]
y = [1, 3, 4, 8]
plt.plot(x, y)
plt.xlabel("x values")
plt.ylabel("y values")
plt.title("plotted x and y values")
plt.legend(["line 1"])

m_figure = plt.gcf()
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import math

# Get the angles from 0 to 2 pie (360 degree) in narray object
X = np.arange(0, math.pi*2, 0.05)
X = np.arange(0, math.pi * 2, 0.05)

# Using built-in trigonometric function we can directly plot
# the given cosine wave for the given angles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,22 @@
import numpy as np
from mpl_toolkits import mplot3d
import matplotlib.pyplot as plt

df = pd.read_csv("/data/auto_clean.csv")


fig = plt.figure(figsize=(10, 10))
ax = plt.axes(projection="3d")
ax.scatter3D(df['length'], df['width'], df['height'],
c = df['peak-rpm'], s = df['price']/50, alpha = 0.4)
ax.scatter3D(
df["length"],
df["width"],
df["height"],
c=df["peak-rpm"],
s=df["price"] / 50,
alpha=0.4,
)
ax.set_xlabel("Length")
ax.set_ylabel("Width")
ax.set_zlabel("Height")
ax.set_title("Relationship between height, weight, and length")
plt.show()
plt.show()
24 changes: 24 additions & 0 deletions data/storage/notebooks/4_example_3d_bar.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
df["body-style"].unique()

df["body_style1"] = df["body-style"].replace(
{"convertible": 1, "hatchback": 2, "sedan": 3, "wagon": 4, "hardtop": 5}
)

gr = df.groupby("body_style1")["peak-rpm", "price"].agg("mean")
x = gr.index
y = gr["peak-rpm"]
z = [0] * 5
colors = ["b", "g", "crimson", "r", "pink"]
dx = 0.3 * np.ones_like(z)
dy = [30] * 5
dz = gr["price"]
fig = plt.figure(figsize=(10, 8))
ax = fig.add_subplot(111, projection="3d")
ax.set_xticklabels(["convertible", "hatchback", "sedan", "wagon", "hardtop"])
ax.set_xlabel("Body Style", labelpad=7)
ax.set_yticks(np.linspace(5000, 5250, 6))
ax.set_ylabel("Peak Rpm", labelpad=10)
ax.set_zlabel("Price")
ax.set_zticks(np.linspace(7000, 22250, 6))
ax.set_title("Change of Price with Body_style and Peak RPM")
ax.bar3d(x, y, z, dx, dy, dz)
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
def z_function(x, y):
return np.sin(np.sqrt(x**2 + y**2))


plt.figure(figsize=(8, 8))
ax = plt.axes(projection="3d")
x = df['peak-rpm']
y = df['city-mpg']
x = df["peak-rpm"]
y = df["city-mpg"]
z = z_function(x, y)
ax.plot_trisurf(x, y, z,
cmap='viridis', edgecolor='none');
ax.plot_trisurf(x, y, z, cmap="viridis", edgecolor="none")
ax.set_xlabel("Peak RPM")
ax.set_ylabel("City-MPG")
ax.set_title("Peak RPM vs City-MPG")
ax.view_init(60, 25)
plt.show()

tri_surf=plt.gcf()
tri_surf = plt.gcf()
43 changes: 2 additions & 41 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,9 @@
version: "3.4"
version: "3"

services:
server:
build: ./server
expose:
- '8080'
volumes:
- ./data:/data
- api-cache:/cache
environment:
- JAVA_TOOL_OPTIONS=-Xmx4g -Ddeephaven.console.type=python

web:
build: ./web
expose:
- '80'
volumes:
- ./data:/data
- web-tmp:/tmp

grpc-proxy:
image: ghcr.io/deephaven/grpc-proxy:${VERSION:-latest}
environment:
- BACKEND_ADDR=server:8080
depends_on:
- server
expose:
- '8080'

envoy:
image: ghcr.io/deephaven/envoy:${VERSION:-latest}
depends_on:
- web
- grpc-proxy
- server
ports:
- "${DEEPHAVEN_PORT:-10000}:10000"

examples:
image: ghcr.io/deephaven/examples:latest
volumes:
- ./data:/data
command: initialize

volumes:
web-tmp:
api-cache:
- "10000:10000"
10 changes: 8 additions & 2 deletions server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
FROM ghcr.io/deephaven/server:${VERSION:-latest}
# pip install any of the plugins required on the server
# syntax=docker/dockerfile:1.4

FROM ghcr.io/deephaven/web-plugin-packager:latest as build
RUN ./pack-plugins.sh @deephaven/js-plugin-matplotlib

FROM ghcr.io/deephaven/server:edge
RUN pip install deephaven-plugin-matplotlib
COPY --link --from=build js-plugins/ /opt/deephaven/config/js-plugins/
COPY --link deephaven.prop /opt/deephaven/config/deephaven.prop
Loading