import matplotlib.pyplot as plt

import numpy as np

xpoints = np.array([1,8])

ypoints = np.array([3,10])

plt.plot(xpoints,ypoints)

plt.show()

Solve Problems by Coding Solutions - A Complete solution for python programming

Showing posts with label **Matplotlib**. Show all posts

Showing posts with label **Matplotlib**. Show all posts

import matplotlib.pyplot as plt

import numpy as np

xpoints = np.array([1,8])

ypoints = np.array([3,10])

plt.plot(xpoints,ypoints)

plt.show()

import matplotlib.pyplot as plt

x=[30,30,20,20]

labeks=["Python","Java","C","C++"]

plt.pie(x,labels=labeks)

plt.show()

import numpy as np

import matplotlib.pyplot as plt

x=np.linspace(0,1)

data1 = np.sin(x)

data2 = np.cos(x)

fig, ax1 = plt.subplots()

color = 'tab:red'

ax1.set_xlabel('x')

ax1.set_ylabel('sine', color=color)

ax1.plot(x, data1, color=color)

ax1.tick_params(axis='y', labelcolor=color)

ax2 = ax1.twinx()

color = 'tab:green'

ax2.set_ylabel('cosine', color=color)

ax2.plot(x, data2, color=color)

ax2.tick_params(axis='y', labelcolor=color)

plt.show()

#Simple Implementation

#---------------------------------------------------------------------

import numpy as np

import matplotlib.pyplot as plt

x = np.linspace(-np.pi, np.pi, 256, endpoint=True)

c= np.cos(x)

s= np.sin(x)

plt.plot(x,c)

plt.plot(x,s)

plt.show()

import matplotlib.pyplot as plt

x=np.linspace(0,1)

data1 = np.sin(x)

data2 = np.cos(x)

fig, ax1 = plt.subplots()

color = 'tab:red'

ax1.set_xlabel('x')

ax1.set_ylabel('sine', color=color)

ax1.plot(x, data1, color=color)

ax1.tick_params(axis='y', labelcolor=color)

ax2 = ax1.twinx()

color = 'tab:green'

ax2.set_ylabel('cosine', color=color)

ax2.plot(x, data2, color=color)

ax2.tick_params(axis='y', labelcolor=color)

plt.show()

#Simple Implementation

#---------------------------------------------------------------------

import numpy as np

import matplotlib.pyplot as plt

x = np.linspace(-np.pi, np.pi, 256, endpoint=True)

c= np.cos(x)

s= np.sin(x)

plt.plot(x,c)

plt.plot(x,s)

plt.show()

Subscribe to:
Posts (Atom)