/ Python And R Data science skills: 77 marker

Sunday, 18 February 2018

77 marker

https://vlrtraining.com/courses/python-data-science-beginner-tutorial 77 marker
In [1]:
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 5, 11)
y = x ** 2 
%matplotlib inline
In [28]:
fig = plt.figure()

ax = fig.add_axes([0,0,1,1])

ax.plot(x, y,color="#808000" ,lw=3,)
Out[28]:
[<matplotlib.lines.Line2D at 0xa7e1780>]
In [29]:
fig = plt.figure()

ax = fig.add_axes([0,0,1,1])

ax.plot(x, y,color="#808000" ,lw=3,marker="+")
Out[29]:
[<matplotlib.lines.Line2D at 0xa7e1630>]
In [4]:
x
Out[4]:
array([ 0. ,  0.5,  1. ,  1.5,  2. ,  2.5,  3. ,  3.5,  4. ,  4.5,  5. ])
In [5]:
y
Out[5]:
array([  0.  ,   0.25,   1.  ,   2.25,   4.  ,   6.25,   9.  ,  12.25,
        16.  ,  20.25,  25.  ])
In [30]:
fig = plt.figure()

ax = fig.add_axes([0,0,1,1])

ax.plot(x, y,color="#808000" ,lw=3,marker="*")
Out[30]:
[<matplotlib.lines.Line2D at 0xa7122e8>]
In [31]:
fig = plt.figure()

ax = fig.add_axes([0,0,1,1])

ax.plot(x, y,color="#808000" ,lw=3,marker="o")
Out[31]:
[<matplotlib.lines.Line2D at 0xb94d550>]
In [10]:
fig = plt.figure()

ax = fig.add_axes([0,0,1,1])

ax.plot(x, y,color="#808000" ,lw=3,marker="+")
Out[10]:
[<matplotlib.lines.Line2D at 0x9475a20>]
In [32]:
fig = plt.figure()

ax = fig.add_axes([0,0,1,1])

ax.plot(x, y,color="#808000" ,lw=.1,marker="1")
Out[32]:
[<matplotlib.lines.Line2D at 0xba295f8>]
In [33]:
fig = plt.figure()

ax = fig.add_axes([0,0,1,1])

ax.plot(x, y,color="#808000" ,lw=1,marker="1",markersize=8)
Out[33]:
[<matplotlib.lines.Line2D at 0xba1a1d0>]
In [34]:
fig = plt.figure()

ax = fig.add_axes([0,0,1,1])

ax.plot(x, y,color="#808000" ,lw=1,marker="2",markersize=18)
Out[34]:
[<matplotlib.lines.Line2D at 0xbb223c8>]
In [35]:
fig = plt.figure()

ax = fig.add_axes([0,0,1,1])

ax.plot(x, y,color="#808000" ,lw=1,marker="3",markersize=18)
Out[35]:
[<matplotlib.lines.Line2D at 0xbb6e128>]
In [20]:
fig = plt.figure()

ax = fig.add_axes([0,0,1,1])

ax.plot(x, y,color="#808000" ,lw=1,marker="4",markersize=18)
Out[20]:
[<matplotlib.lines.Line2D at 0xa58d748>]
In [36]:
fig = plt.figure()

ax = fig.add_axes([0,0,1,1])

ax.plot(x, y,color="#808000" ,lw=1,marker="o",markersize=18)
Out[36]:
[<matplotlib.lines.Line2D at 0xbc075c0>]
In [22]:
fig = plt.figure()

ax = fig.add_axes([0,0,1,1])

ax.plot(x, y,color="#808000" ,lw=1,marker="o",markersize=18,
        markerfacecolor="red")
Out[22]:
[<matplotlib.lines.Line2D at 0xa617fd0>]
In [37]:
fig = plt.figure()

ax = fig.add_axes([0,0,1,1])

ax.plot(x, y,color="#808000" ,lw=1,marker="o",markersize=18,
        markerfacecolor="g")
Out[37]:
[<matplotlib.lines.Line2D at 0xbc697f0>]
In [38]:
fig = plt.figure()

ax = fig.add_axes([0,0,1,1])

ax.plot(x, y,color="b" ,lw=1,marker="o",markersize=18,
        markerfacecolor="g",markeredgewidth=3)
Out[38]:
[<matplotlib.lines.Line2D at 0xbb9a9b0>]
In [39]:
fig = plt.figure()

ax = fig.add_axes([0,0,1,1])

ax.plot(x, y,color="b" ,lw=1,marker="o",markersize=18,
        markerfacecolor="g",markeredgewidth=3,markeredgecolor="r")
Out[39]:
[<matplotlib.lines.Line2D at 0xbd3ccc0>]
In [27]:
fig, ax = plt.subplots(figsize=(12,6))

ax.plot(x, x+1, color="red", linewidth=0.25)
ax.plot(x, x+2, color="red", linewidth=0.50)
ax.plot(x, x+3, color="red", linewidth=1.00)
ax.plot(x, x+4, color="red", linewidth=2.00)

# possible linestype options ‘-‘, ‘–’, ‘-.’, ‘:’, ‘steps’
ax.plot(x, x+5, color="green", lw=3, linestyle='-')
ax.plot(x, x+6, color="green", lw=3, ls='-.')
ax.plot(x, x+7, color="green", lw=3, ls=':')

# custom dash
line, = ax.plot(x, x+8, color="black", lw=1.50)
line.set_dashes([5, 10, 15, 10]) # format: line length, space length, ...

# possible marker symbols: marker = '+', 'o', '*', 's', ',', '.', '1', '2', '3', '4', ...
ax.plot(x, x+ 9, color="blue", lw=3, ls='-', marker='+')
ax.plot(x, x+10, color="blue", lw=3, ls='--', marker='o')
ax.plot(x, x+11, color="blue", lw=3, ls='-', marker='s')
ax.plot(x, x+12, color="blue", lw=3, ls='--', marker='1')

# marker size and color
ax.plot(x, x+13, color="purple", lw=1, ls='-', marker='o', markersize=2)
ax.plot(x, x+14, color="purple", lw=1, ls='-', marker='o', markersize=4)
ax.plot(x, x+15, color="purple", lw=1, ls='-', marker='o', markersize=8, markerfacecolor="red")
ax.plot(x, x+16, color="purple", lw=1, ls='-', marker='s', markersize=8, 
        markerfacecolor="yellow", markeredgewidth=3, markeredgecolor="green");

No comments:

Post a Comment