File:Proportionality.svg

Summary

Description
English: Examples for proportionality.
Date
Source Own work
Author Rumil
 W3C-validity not checked.Category:Unchecked SVG validity

Source code

import matplotlib as mp
import matplotlib.pyplot as plot
import numpy as np
from math import pi

style = {
  "axes.linewidth": 3,
  "grid.linewidth": 3,
  "grid.linestyle": "solid",
  "grid.color": "#dadaca",
  "lines.linewidth": 3,
  "lines.markersize": 10,
  "xtick.labelsize": 20,
  "ytick.labelsize": 20,
}

for key in style:
  mp.rcParams[key]=style[key]

fig = plot.figure()
ax = fig.add_subplot(1, 1, 1)
ax.set_aspect('equal')
color1 = "#707070"
ax.spines['bottom'].set_color(color1)
ax.spines['top'].set_color(color1) 
ax.spines['right'].set_color(color1)
ax.spines['left'].set_color(color1)
# ax.spines['left'].set_position('center')
# ax.spines['bottom'].set_position('center')

ax.axhline(y=0, color=color1,zorder=4)
ax.axvline(x=0, color=color1,zorder=4)

# plot.grid(True)
ax.xaxis.grid()
ax.yaxis.grid()
ax.set_axisbelow(True)
ax.xaxis.set_tick_params(width=3,length=4,color=color1)
ax.yaxis.set_tick_params(width=3,length=4,color=color1)

x = np.arange(-2,6,0.01)
plot.axis([-2,6,-2,6])

plot.plot(x,x,color='#a0a0a0',zorder=5,linestyle="dashed")
plot.plot(x,2*x,color='#0000b0',zorder=6)
plot.plot(x,0.5*x,color='#008000',zorder=5)
plot.plot(x,-0.25*x,color='#a00040',zorder=5)

ax.text(1.5,4.2,"f", fontsize=28, style="italic", color="#0000b0")
ax.text(4.2,1.5,"g", fontsize=28, style="italic", color="#008000")
ax.text(4.2,-0.8,"h", fontsize=28, style="italic", color="#a00040")

# plot.show()
plot.savefig("Proportionality.svg",bbox_inches='tight')


Licensing

I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

Category:CC-Zero#Proportionality.svgCategory:Self-published work
Category:SVG Linear function
Category:CC-Zero Category:SVG Linear function Category:Self-published work Category:Unchecked SVG validity