×

Python Tutorial

Python Basics

Python I/O

Python Operators

Python Conditions & Controls

Python Functions

Python Strings

Python Modules

Python Lists

Python OOPs

Python Arrays

Python Dictionary

Python Sets

Python Tuples

Python Exception Handling

Python NumPy

Python Pandas

Python File Handling

Python WebSocket

Python GUI Programming

Python Image Processing

Python Miscellaneous

Python Practice

Python Programs

Python | Y Shape Scatter Marker

In this tutorial, we are going to learn how to use Y shape scatter marker in scatter plot using matplotlib in Python?
Submitted by Anuj Singh, on August 17, 2020

There are few markers that can be used everywhere such as circular or square markers. But, matplotlib has some other inbuilt defined markers such as tri-edge Y shape marker which is used in directional plots. In matplotlib.pyplot command marker='4' for our desired marker style and the following figure illustrates the example of the same.

Illustrations:

Python | Y Shape Scatter Marker (1)

Python | Y Shape Scatter Marker (2)

Python code for y-shape scatter marker

import matplotlib.pyplot as plt
import numpy as np

x = np.arange(0.0, 50.0, 2.0)
y = x ** 2.5 + np.random.rand(*x.shape) * 30.0
s = np.random.rand(*x.shape) * 800 + 500

plt.scatter(x, y, s, c="g", alpha=0.8, marker='4')
plt.xlabel("X axis")
plt.ylabel("Y axis")
plt.show()

x = np.arange(104)
y = np.random.randint(0,104,104)
s = np.random.rand(104) * 800 + 500

plt.scatter(x, y, s, c="g", alpha=0.8, marker='4')
plt.xlabel("X axis")
plt.ylabel("Y axis")
plt.show()

Output:

Output is as Figure
Advertisement
Advertisement


Comments and Discussions!

Load comments ↻


Advertisement
Advertisement
Advertisement

Copyright © 2025 www.includehelp.com. All rights reserved.