File:Epicycloid2 vectorial.svg

Summary

Description
English: Set of epicycloidal curves
Date
Source Own work
Author Guillaume Jacquenot
SVG development
InfoField
 
The source code of this SVG is invalid due to 275 errors.
 
This W3C-invalid plot was created with Matplotlib.
Category:Invalid SVG created with Matplotlib code#0004Epicycloid2%20vectorial.svg
Source code
InfoField

Python code

# -*- coding: utf-8 -*-
#
# Script to generate a set of epicycloidal curve.
#
# Guillaume Jacquenot
# 2013 03 20

import numpy as np
import matplotlib
from matplotlib.pyplot import figure, show, rc, grid, legend

def epicycloid(r1=1,r2=1, theta = np.arange(0.0,2*np.pi,0.005)):
    x = (r1+r2)*np.cos(theta)-r2*np.cos((r1+r2)/r2*theta)
    y = (r1+r2)*np.sin(theta)-r2*np.sin((r1+r2)/r2*theta)
    return x,y

def makePlot(outputFilename = r'Epicycloid2_vectorial.svg'):
    rc('grid', linewidth = 0.75, linestyle = '-', color = '#a0a0a0')
    rc('xtick', labelsize = 12)
    rc('ytick', labelsize = 12)
    rc('font',**{'family':'serif','serif':['Palatino'],'size':12})
    rc('text', usetex=True)

    fig = figure()
    ax = fig.add_axes([0.12, 0.12, 0.76, 0.76])#axisbg='#d5de9c'
    x,y = epicycloid(r2=1.0/4.0)
    ax.plot(x, y, color='#ee8d18', lw = 1.5, label=r'$r_2=1/4$')
    x,y = epicycloid(r2=1.0/3.0)
    ax.plot(x, y, color='m', lw = 1.5, label=r'$r_2=1/3$')
    x,y = epicycloid(r2=1.0/2.0)
    ax.plot(x, y, color='c', lw = 1.5, label=r'$r_2=1/2$')
    x,y = epicycloid(r2=1.0)
    ax.plot(x, y, color='g', lw = 1.5, label=r'$r_2=1$')
    x,y = epicycloid(r2=2.0, theta = np.arange(0.0,4*np.pi,0.005))
    ax.plot(x, y, color='r', lw = 1.5, label=r'$r_2=2$')
    x,y = epicycloid(r2=3.0, theta = np.arange(0.0,6*np.pi,0.005))
    ax.plot(x, y, color='b', lw = 1.5, label=r'$r_2=3$')
    ax.set_aspect('equal')
    grid(True)
    box = ax.get_position()
    ax.set_position([box.x0, box.y0 + box.height * 0.1,
                     box.width, box.height * 0.9])
    ax.legend(loc='upper center', bbox_to_anchor=(0.5, -0.08),
              ncol=3)
    ax.set_xlabel('$x$')
    ax.set_ylabel('$y$',rotation=0)
    ax.set_title(r'\begin{tabular}{lcll}'+\
                 r'$x$ &=&$(r_1+r_2) \cos\theta - r_2 \cos\left(\frac{r_1+r_2}{r_2}\theta\right)$&, $r_1=1$\\'+\
                 r'$y$ &=&$(r_1+r_2) \sin\theta - r_2 \sin\left(\frac{r_1+r_2}{r_2}\theta\right)$&, $r_1=1$'+\
                 r'\end{tabular}',
                 fontsize=12)
    fig.savefig(outputFilename)
    fig.show()

makePlot()

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
Category:CC-BY-SA-3.0#Epicycloid2%20vectorial.svg
Category:Self-published work Category:Epicycloid Category:Images with Python source code
Category:CC-BY-SA-3.0 Category:Epicycloid Category:Images with Python source code Category:Invalid SVG created with Matplotlib code Category:Self-published work