What do you want to save?
Add Code snippet
New code examples
-
Python 2022-01-29 09:26:37
k-means
import tkinter as tk from tkinter import filedialog import pandas as pd from pandas import DataFrame import matplotlib.pyplot as plt from sklearn.cluster import KMeans from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg root= tk.Tk() canvas1... Add solution -
Python 2022-01-26 07:30:09
poisson disc python
import numpy as np import matplotlib.pyplot as plt # Choose up to k points around each reference point as candidates for a new # sample point k = 30 # Minimum distance between samples r = 1.7 width, height = 60, 45 # Cell side length a = r/np.sqrt(2) ... Add solution -
Python 2022-01-26 00:25:53
3d plots in python
from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111, projection='3d') x =[1,2,3,4,5,6,7,8,9,10] y =[5,6,2,3,13,4,1,2,4,8] z =[2,3,3,3,5,7,9,11,9,10] ax.scatter(x, y, z, c='r', marker='... Add solution -
Python 2022-01-24 02:26:08
python create adictionary randomly assigning clors to categorical vairables
# Unique category labels: 'D', 'F', 'G', ... color_labels = df['color'].unique() # List of RGB triplets rgb_values = sns.color_palette("Set2", 8) # Map label to RGB color_map = dict(zip(color_labels, rgb_values)) # Finally use the mapped valu... Add solution -
Python 2022-01-22 22:30:33
multiple axes plotly with title
import plotly.graph_objects as go from plotly.subplots import make_subplots # Create figure with secondary y-axis fig = make_subplots(specs=[[{"secondary_y": True}]]) # Add traces fig.add_trace( go.Scatter(x=[1, 2, 3], y=[40, 50, 60], name... Add solution -
Javascript 2022-01-22 04:45:32
postgresql json array contains
CREATE TABLE public.json_table (myjson json); INSERT INTO public.json_table VALUES('{"coord":{"lon":-0.13,"lat":51.51},"sys": {"type":3,"id":98614,"message":0.0218,"country":&... Add solution -
Python 2021-11-16 21:48:21
python bubble plot
import matplotlib.pyplot as plt # scatter plot with scatter() function # bubble size with "s" # df dataframe contain columns X, Y, Z variables values plt.scatter('X', 'Y', s='Z', data=df) plt.xlabel("X", size=16) plt.ylabel("y&quo... Add solution