This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.addEventListener("load", () => { | |
const canvas = document.querySelector("#canvas"); | |
const ctx = canvas.getContext('2d'); | |
const img = new Image(); | |
img.src = "assets/images/reinePic.jpg"; | |
img.onload = () => { | |
const [img_scaled_width, img_scaled_height] = drawImageToScale(img, ctx); | |
canvas.width = img_scaled_width; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body> | |
<div id="drawingComp"> | |
<canvas id="canvas"></canvas> | |
<div class="controls"> | |
<label id="clearLabel"><button id="clear">X</button> Clear</label> | |
<label id="blackColourLabel"><button id="blackColour">O</button> Black Colour</label> | |
<label id="whiteColourLabel"><button id="whiteColour">O</button> White Colour</label> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.addEventListener("load", () => { | |
const clearButton = document.querySelector('#clear'); | |
const blackButton = document.querySelector('#blackColour'); | |
const whiteButton = document.querySelector('#whiteColour'); | |
const canvas = document.querySelector("#canvas"); | |
const ctx = canvas.getContext('2d'); | |
const img = new Image(); | |
img.src = "assets/images/reinePic.jpg"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*{ | |
margin:0; | |
padding:0; | |
box-sizing: border-box; | |
} | |
#drawingComp { | |
display:flex; | |
align-items:center; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from "react"; | |
function Example() { | |
// Declare a new state variable, which we'll call "count" | |
const [count, setCount] = useState(0); | |
return ( | |
<div> | |
<p>You clicked {count} times</p> | |
<button onClick={() => setCount(count + 1)}>Click me</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import logo from "./logo.svg"; | |
import "./App.css"; | |
import Example from "./Example"; | |
function App() { | |
return ( | |
<div className="App"> | |
<header className="App-header"> | |
<img src={logo} className="App-logo" alt="logo" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@app.route("/upload", methods=['POST']) | |
def upload(): | |
target = os.path.join(APP_ROOT, 'images/') | |
print("TARGET", target) | |
if not os.path.isdir(target): | |
os.mkdir(target) | |
else: | |
print("Couldn't create upload directory: {}".format(target)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from urllib.request import urlopen | |
import requests | |
import urllib.request | |
import igraph as ig | |
import chart_studio.plotly as py | |
from plotly.offline import iplot | |
import plotly.graph_objs as go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
G=ig.Graph(Edges, directed=False) | |
layt=G.layout('kk', dim=3) # plot network with the Kamada-Kawai layout algorithm | |
print(G) | |
print(layt[:3]) | |
print(Edges[:3]) | |
labels=[] | |
group=[] | |
for node in data['nodes']: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trace1=go.Scatter3d(x=Xe, y=Ye, z=Ze, mode='lines', line=dict(color='rgb(125,125,125)', width=1),hoverinfo='none') | |
trace2=go.Scatter3d(x=Xn, y=Yn, z=Zn, mode='markers', name='actors', | |
marker=dict(symbol='circle', size=6, color=group, colorscale='Viridis', | |
line=dict(color='rgb(50,50,50)', width=0.5)), text=labels, hoverinfo='text') | |
axis=dict(showbackground=False, showline=False, zeroline=False, showgrid=False, showticklabels=False, title='') | |
layout = go.Layout( | |
title="Network of coappearances of characters in Victor Hugo's novel<br> Les Miserables (3D visualization)", |
OlderNewer