Pyplot error "only size-1 arrays can be converted to Python scalars"

0 votes
I am getting the following error while drawing butterfly curve:

Pyplot error "only size-1 arrays can be converted to Python scalars"

And following is the code:

import numpy as np
import matplotlib.pyplot as plt
import math

t = np.arange(0.,10,0.1)
x = math.sin(t)*(math.exp(math.cos(t)) - 2*math.cos(4*t) - math.sin(t/12)**5)
a = np.vectorize(x)
y = math.cos(t)*(math.exp(math.cos(t)) - 2*math.cos(4*t) - math.sin(t/12)**5)
b = np.vectorize(y)

plt.plot(a,b,color='red')

plt.show()
Nov 28 in Python by Sumit
• 130 points
80 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Python

0 votes
1 answer

Pyplot error "only size-1 arrays can be converted to Python scalars"

You can plot the chart by taking ...READ MORE

answered Jan 28 in Python by Omkar
• 68,180 points
2,940 views
0 votes
0 answers

Python error "only size-1 arrays can be converted to Python scalars"

I'm trying to plot the exponential and ...READ MORE

Jul 9 in Python by JTM
380 views
0 votes
1 answer
+1 vote
1 answer

Can assignment operator be used to copy elements in Python?

Yes assignment operator can be used to ...READ MORE

answered Jul 29 in Python by Neel
• 3,010 points

edited Jul 30 by Neel 26 views
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
245 views
0 votes
1 answer