কম্পিউটার টিউটোরিয়াল

Matplotlib-এ লুপ আকারের অ্যারো তৈরির পদ্ধতি?


Matplotlib-এ লুপ আকারের অ্যারো তৈরি করতে নিচের ধাপগুলো অনুসরণ করুন:

  • ফিগার আকার সেট করুন এবং সাবপ্লটগুলির মধ্যে এবং চারপাশে প্যাডিং সামঞ্জস্য করুন।
  • Matplotlib-এ অ্যারো লুপ তৈরি করতে make_loop() পদ্ধতি ব্যবহার করুন।
  • center, radius, theta1, theta2 এবং width সহ একটি wedge ইনস্ট্যান্স তৈরি করুন।
  • লুপের শীর্ষে অ্যারো রাখতে PathCollection ব্যবহার করুন।
  • বর্তমান অ্যাক্সেসে প্যাচ কালেকশন যোগ করুন।
  • ফিগারটি প্রদর্শন করতে show() পদ্ধতি ব্যবহার করুন।

উদাহরণ

from matplotlib import pyplot as plt, patches, collections
plt.rcParams["figure.figsize"] = [7.50, 3.50]
plt.rcParams["figure.autolayout"] = True
def make_loop(center, radius, theta1=-30, theta2=180):
    rwidth = 0.02
    ring = patches.Wedge(center, radius, theta1, theta2, width=rwidth)
    offset = 0.02
    xcent = center[0] - radius + (rwidth / 2)
    left = [xcent - offset, center[1]]
    right = [xcent + offset, center[1]]
    bottom = [(left[0] + right[0]) / 2., center[1] - 0.05]
    arrow = plt.Polygon([left, right, bottom, left])
    p = collections.PatchCollection(
        [ring, arrow],
        edgecolor='orange',
        facecolor='red'
    )
    ax.add_collection(p)
fig, ax = plt.subplots()
make_loop(center=(.5, .7), radius=.1)
plt.show()

আউটপুট

Matplotlib-এ লুপ আকারের অ্যারো তৈরির পদ্ধতি?


  1. Matplotlib-এ স্ক্যাটার প্লটকে গ্রুপ হিসেবে ট্রান্সপারেন্ট করার পদ্ধতি

  2. Matplotlib-এ সাবপ্লট টিক মার্ক বড় করার পদ্ধতি

  3. Matplotlib-এ ডেটার লিস্ট থেকে হিস্টোগ্রাম বানানোর পদ্ধতি

  4. Python-এ matplotlib ব্যবহার করে একই পেজে একাধিক প্লট করার পদ্ধতি