π 1. Using LIST with Matplotlib
Lists are the most common data type used for plotting.
Example: Line Plot using List
π 2. Using TUPLE with Matplotlib
Matplotlib accepts tuples just like lists.
Example: Bar Chart using Tuple
π 3. Using SET with Matplotlib
A set does not maintain order.
We must convert it to a sorted list for plotting.
Example: Scatter Plot using Set
π 4. Using DICTIONARY with Matplotlib
Dictionary stores data as key:value.
Example: Bar Chart using Dictionary
π― Summary Table
| Data Type | Accepted by Matplotlib? | Notes |
|---|---|---|
| List | ✔ Yes | Most commonly used |
| Tuple | ✔ Yes | Same as list |
| Set | ⚠️ Yes but needs sorting | Convert to list first |
| Dictionary | ✔ Yes | Use keys & values separately |
No comments:
Post a Comment