Logo

ML
Author

Nipun Batra

Published

January 2, 2024

import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
# Linear classification plot
x = np.linspace(0, 2, 100)
y = 0.1 * x**2 + 2
plt.plot(x, y, label='Linear Classification', color='navy', lw=3)

# Scattered points for two different classes
random_idx = np.random.randint(0, 100, 10)
class_1_points = y - 0.7*np.random.rand(100)
class_2_points = y + 0.7*np.random.rand(100)

# Scatter circles for Class 1 (hollow)
plt.scatter(x[random_idx], class_1_points[random_idx],
            edgecolors='black', facecolors='none', marker='o', label='Class 1', lw=2)

# Scatter diamonds for Class 2 (hollow)
plt.scatter(x[random_idx], class_2_points[random_idx], 
            edgecolors='black', facecolors='none', marker='D', label='Class 2', lw=2)

# Adding text in black
plt.text(1, 1, 'Sustainability Lab', fontsize=36, ha='center', color='black')
plt.text(1, 0.3, 'AI for Sustainability', fontsize=16, ha='center', color='black')

plt.axis('off')

plt.tight_layout()

# Create a grey background for the entire figure
fig, ax = plt.subplots(figsize=(4, 5))
fig.patch.set_facecolor('#F4F4F0')  # Light grey background color

# Quadratic classification plot with a curved line
x = np.linspace(0, 2, 100)
y = 0.1 * x**2 + 2
ax.plot(x, y, label='Quadratic Classification', color='navy', linewidth=3)

# Scattered points for two different classes
np.random.seed(42)
random_idx = np.random.randint(0, 100, 10)
class_1_points = y - 0.7 * np.random.rand(100)
class_2_points = y + 0.7 * np.random.rand(100)

# Scatter circles for Class 1 (hollow)
ax.scatter(x[random_idx], class_1_points[random_idx],
           edgecolors='navy', facecolors='none', marker='o', label='Class 1', linewidth=2)

# Scatter diamonds for Class 2 (hollow)
ax.scatter(x[random_idx], class_2_points[random_idx], 
           edgecolors='navy', facecolors='none', marker='D', label='Class 2', linewidth=2)

# Adding text in black with adjusted positions
ax.text(1, 0.7, 'Sustainability Lab', fontsize=24, ha='center', color='navy')
ax.text(1, 0.3, 'AI for Sustainability', fontsize=14, ha='center', color='navy')

# Remove x and y-axis ticks and labels for a cleaner look
ax.set_xticks([])
ax.set_yticks([])

# Show the legend
#ax.legend()

# Remove top and right spines
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)

# Set the face color of the plot area to grey
ax.set_facecolor('#F4F4F0')

# Set the width of the axes
ax.spines['bottom'].set_linewidth(3)
ax.spines['left'].set_linewidth(3)

plt.tight_layout()

# Draw sigmoid function to write S and write L besides it
import matplotlib.patches as patches


def sigmoid(x):
    return 1 / (1 + np.exp(-x))

x_range = np.linspace(-20, 20, 800)

plt.plot(x_range, sigmoid(x_range), label='Sigmoid Function', color='navy',
          lw=30, alpha=0.8)

# Draw "X" around x = 13, 17, 19
xs_plus = np.array([13, 17, 19])
plt.scatter(xs_plus, sigmoid(xs_plus), color='white', marker='X', s=250, zorder=3)

xs_o = np.array([-10, -14, -18])
plt.scatter(xs_o, sigmoid(xs_o), color='white', marker='o', s=250, zorder=3)

ax = plt.gca()

ax.set_xticks([])
ax.set_yticks([])

# Show the legend
#ax.legend()

# Remove top and right spines
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.spines['left'].set_visible(False)
ax.spines['bottom'].set_visible(False)


# Set the face color of the plot area to grey
ax.set_facecolor('#F4F4F0')

# Draw L-shaped figure from x = 25 onwards to match sigmoid height
# The height of the sigmoid function is between 0 and 1
l_height = sigmoid(25)
vertical_part = patches.Rectangle((25, -0.05), 5, l_height + 0.05, facecolor='navy')
horizontal_part = patches.Rectangle((25, -0.05), 15, 0.1, facecolor='navy')

# Add the L-shape to the plot
ax.add_patch(vertical_part)
ax.add_patch(horizontal_part)

x_start = 25
y_start = 0
x_end = 40

# add resistor symbol
x_resistor = np.linspace(x_start + 1, x_end - 1, (x_end - x_start - 2)*2)
y_resistor = np.zeros_like(x_resistor)
# odd places are +0.05 and even places are -0.05
y_resistor[1::2] += 0.03
y_resistor[::2] -= 0.03
plt.plot(x_resistor, y_resistor, color='white', lw=2)

import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import FancyBboxPatch

# Sigmoid function
def sigmoid(x):
    return 1 / (1 + np.exp(-x))

# Generate data
x_range = np.linspace(-20, 20, 1200)
y_range = sigmoid(x_range)

fig, ax = plt.subplots(figsize=(10, 6))

# Plot sigmoid function with shadow
ax.plot(x_range, y_range, label='Sigmoid Function', color='navy', lw=10, zorder=3)
ax.plot(x_range, y_range - 0.03, color='grey', lw=10, alpha=0.4, zorder=2)

# Draw 'S' using 'X' markers
xs_plus = np.array([13, 17, 19])
ys_plus = sigmoid(xs_plus)
ax.scatter(xs_plus, ys_plus, color='white', edgecolor='black', marker='X', s=300, zorder=4)

# Draw 'S' using 'o' markers
xs_o = np.array([-10, -14, -18])
ys_o = sigmoid(xs_o)
ax.scatter(xs_o, ys_o, color='white', edgecolor='black', marker='o', s=300, zorder=4)

# Draw 'L' shape
l_height = sigmoid(7)
vertical_part = FancyBboxPatch((7, 0), 0.5, l_height, boxstyle="round,pad=0.1", facecolor='navy', edgecolor='black', lw=2)
horizontal_part = FancyBboxPatch((7, 0), 3, 0.5, boxstyle="round,pad=0.1", facecolor='navy', edgecolor='black', lw=2)

# Add the L-shape to the plot
ax.add_patch(vertical_part)
ax.add_patch(horizontal_part)

# Add shadow to 'L' shape
vertical_shadow = FancyBboxPatch((7.05, -0.05), 0.5, l_height, boxstyle="round,pad=0.1", facecolor='grey', alpha=0.3, zorder=1)
horizontal_shadow = FancyBboxPatch((7.05, -0.05), 3, 0.5, boxstyle="round,pad=0.1", facecolor='grey', alpha=0.3, zorder=1)

ax.add_patch(vertical_shadow)
ax.add_patch(horizontal_shadow)

# Set the face color of the plot area to grey
ax.set_facecolor('#F4F4F0')

# Remove ticks and labels
ax.set_xticks([])
ax.set_yticks([])

# Remove spines
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.spines['left'].set_visible(False)
ax.spines['bottom'].set_visible(False)

plt.show()

import numpy as np
import matplotlib.pyplot as plt

def make_logo(fig_size=(10, 5), color='navy'):
    # Sigmoid function
    def sigmoid(x):
        return 1 / (1 + np.exp(-x))

    # Generate data
    x_range = np.linspace(-20, 20, 1200)
    y_range = sigmoid(x_range)

    fig, ax = plt.subplots(figsize=fig_size)

    # Plot sigmoid function with shadow
    ax.plot(x_range, y_range, label='Sigmoid Function', color=color, lw=10, zorder=3)
    ax.plot(x_range, y_range - 0.03, color='grey', lw=10, alpha=0.4, zorder=2)

    # Draw 'S' using 'X' markers
    xs_plus = np.array([13, 17, 19])
    ys_plus = sigmoid(xs_plus)
    ax.scatter(xs_plus, ys_plus, color='white', edgecolor='black', marker='X', s=300, zorder=4)

    # Draw 'S' using 'o' markers
    xs_o = np.array([-10, -14, -18])
    ys_o = sigmoid(xs_o)
    ax.scatter(xs_o, ys_o, color='white', edgecolor='black', marker='o', s=300, zorder=4)

    # Draw thick 'L' shaped coordinate axes
    ax.plot([0, 20], [0, 0], color=color, lw=8, zorder=3)  # Positive x-axis
    ax.plot([0, 0], [0, 1], color=color, lw=8, zorder=3)   # Positive y-axis

    # Draw shadow for 'L' shaped coordinate axes
    ax.plot([0, 20], [-0.02, -0.02], color='grey', lw=8, alpha=0.4, zorder=2)  # Shadow for x-axis
    ax.plot([0.05, 0.05], [0, 1], color='grey', lw=8, alpha=0.4, zorder=2)    # Shadow for y-axis

    # Set the face color of the plot area to grey
    ax.set_facecolor('#F4F4F0')

    # Remove ticks and labels
    ax.set_xticks([])
    ax.set_yticks([])

    # Remove spines
    ax.spines['top'].set_visible(False)
    ax.spines['right'].set_visible(False)
    ax.spines['left'].set_visible(False)
    ax.spines['bottom'].set_visible(False)
make_logo()

make_logo(fig_size=(8, 4), color='green')

make_logo(fig_size=(8, 4), color='red')

make_logo(fig_size=(8, 4), color='black')

make_logo(fig_size=(8, 4), color='navy')

make_logo(color='#4169E1')

make_logo(color='#9932CC')

make_logo(color='#DAA520')

make_logo(color='#B22222')

import numpy as np
import matplotlib.pyplot as plt
from matplotlib import font_manager as fm

def make_logo(fig_size=(10, 5), color='navy'):
    # Sigmoid function
    def sigmoid(x):
        return 1 / (1 + np.exp(-x))

    # Generate data
    x_range = np.linspace(-20, 20, 1200)
    y_range = sigmoid(x_range)

    fig, ax = plt.subplots(figsize=fig_size)

    # Plot sigmoid function with shadow
    ax.plot(x_range, y_range, label='Sigmoid Function', color=color, lw=10, zorder=3)
    ax.plot(x_range, y_range - 0.03, color='grey', lw=10, alpha=0.4, zorder=2)

    # Draw 'S' using 'X' markers
    xs_plus = np.array([13, 17, 19])
    ys_plus = sigmoid(xs_plus)
    ax.scatter(xs_plus, ys_plus, color='white', edgecolor='black', marker='X', s=300, zorder=4)

    # Draw 'S' using 'o' markers
    xs_o = np.array([-10, -14, -18])
    ys_o = sigmoid(xs_o)
    ax.scatter(xs_o, ys_o, color='white', edgecolor='black', marker='o', s=300, zorder=4)

    # Draw thick 'L' shaped coordinate axes
    ax.plot([0, 20], [0, 0], color=color, lw=8, zorder=3)  # Positive x-axis
    ax.plot([0, 0], [0, 1], color=color, lw=8, zorder=3)   # Positive y-axis

    # Draw shadow for 'L' shaped coordinate axes
    ax.plot([0, 20], [-0.02, -0.02], color='grey', lw=8, alpha=0.4, zorder=2)  # Shadow for x-axis
    ax.plot([0.05, 0.05], [0, 1], color='grey', lw=8, alpha=0.4, zorder=2)    # Shadow for y-axis

    # Set the face color of the plot area to grey
    ax.set_facecolor('#F4F4F0')

    # Remove ticks and labels
    ax.set_xticks([])
    ax.set_yticks([])

    # Remove spines
    ax.spines['top'].set_visible(False)
    ax.spines['right'].set_visible(False)
    ax.spines['left'].set_visible(False)
    ax.spines['bottom'].set_visible(False)

    # Add text in beautiful font
    prop = fm.FontProperties(fname=fm.findSystemFonts(fontpaths=None, fontext='ttf')[0], size=20)
    ax.text(1.02, 0.7, 'Sustainability Lab', ha='center', va='center', transform=ax.transAxes, fontproperties=prop, fontsize=64, color=color, fontweight='bold')
    ax.text(1.02, 0.5, 'AI and Sensing for Sustainability', ha='center', va='center', transform=ax.transAxes, fontproperties=prop, fontsize=36, color=color)

    fig.patch.set_facecolor('#F4F4F0')
    
# Example usage with 'Royal Blue'
make_logo(color='tomato')

make_logo(color='navy')