Skip to content

Instantly share code, notes, and snippets.

View erikaris's full-sized avatar

Erika Siregar erikaris

  • Old Dominion University
  • Norfolk, Virginia
View GitHub Profile
@erikaris
erikaris / intro_ggplot_erika_siregar.html
Created September 21, 2021 10:11
my talk about intro to ggplot
This file has been truncated, but you can view the full file.
<!DOCTYPE html>
<html>
<head>
<title>Data Visualization with ggplot2</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="generator" content="pandoc" />
@erikaris
erikaris / data_error.csv
Last active January 20, 2018 09:53 — forked from soedomoto/index.html
Test Landing Page
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 1.
"URUT","R101","R102","R105","R107","R108","R401","R403","R404","R405","R406A","R406B","R407","R408","R409","R410","R411","R412","R413","R504","R505","R506","R507","R508","R509","R510","R511A","R511B","R511C","R512","R513","R514","R515","R603","R604","R605","R606","R607","R608","R609","R610","R611","R612","R613","R614","R615","R616","R617","R618","R619","R620","R703","R704","R705","R706","R707","R708","R709A","R709B","R709C","R709D","R709E","R709F","R709G","R709H","R710","R711A","R711B","R711C","R711D","R711E","R711F","R711G","R711X","R803","R804A","R804B","R804C","R804D","R804E","R804F","R804G","R805","R806","R807","R808","R809","R810","R901","R902","R903A","R903B","R904A","R904B","R905","R906","R907A","R907B","R907C","R907D","R907E","R907F","R907G","R907H","R907I","R907J","R907K","R907L","R907M","R908","R909","R910","R911","R912","R913","R914","R915","R916","R917","R918","R919","R920","R921A","R921B","R921BI","R921BII","R922A","R922B","R922C","R922D","R922E","R922F","R922G","R922H","R922I","R922J","R1001A","
@erikaris
erikaris / .block
Last active January 21, 2018 10:01
Root Error Finding in D3
license: mit
# modified from: http://matplotlib.org/users/event_handling.html?highlight=event%20picking#event-attributes
from matplotlib import pyplot as plt
#
class LineBuilder:
def __init__(self, line):
self.line = line
self.xs = list(line.get_xdata())
self.ys = list(line.get_ydata())
# cid = connection id
# modified from https://matplotlib.org/api/backend_bases_api.html#matplotlib.backend_bases.PickEvent
%matplotlib notebook
plt.figure()
plt.gca().plot(np.random.rand(100), 'o', picker=5) # 5 points tolerance
plt.show()
txt=None
def on_pick(event):
# source: https://matplotlib.org/examples/event_handling/data_browser.html
import numpy as np
class PointBrowser(object):
"""
Click on a point to select and highlight it -- the data that
generated the point will be shown in the lower axes. Use the 'n'
and 'p' keys to browse through the next and previous points
# taken from: https://stackoverflow.com/questions/5600370/python-matplotlib-add-and-remove-text-to-figure-using-button-events#answer-5600964
txt = None
def onclick(event):
global txt # why global txt? because there's a variable assignment
txt = plt.text(event.xdata, event.ydata, 'TESTTEST', fontsize=8)
fig.canvas.draw()
def offclick(event):
def f():
global s
print(s)
s = "Mukhlisina"
print(s)
s = "Erika Siregar"
f()
print(s) # s here is the global s
# since there is a variable assignment inside function f,
# f will only care about the local variable 's'
# and will not think about the global variable 's'
def f():
print(s)
s = "Mukhlisina"
print(s)
s = "Erika Siregar"
# This function has a global variable
# and local variable with the same name 's'
# there's a variable assignment inside the function f
# thus, it only recognizes the local variable
# which is: s = "Mukhlisina"
def f():
s = "Mukhlisina"
print(s)