matplotlib markers的类型

 

https://matplotlib.org/api/markers_api.html

 

matplotlib markers

所有可能的markers定义如下:

marker

symbol

description

"."

point

","

pixel

"o"

circle

"v"

triangle_down

"^"

triangle_up

"<"

triangle_left

">"

triangle_right

"1"

tri_down

"2"

tri_up

"3"

tri_left

"4"

tri_right

"8"

octagon

"s"

square

"p"

pentagon

"P"

plus (filled)

"*"

star

"h"

hexagon1

"H"

hexagon2

"+"

plus

"x"

x

"X"

x (filled)

"D"

diamond

"d"

thin_diamond

"|"

vline

"_"

hline

0 (TICKLEFT)

tickleft

1 (TICKRIGHT)

tickright

2 (TICKUP)

tickup

3 (TICKDOWN)

tickdown

4 (CARETLEFT)

caretleft

5 (CARETRIGHT)

caretright

6 (CARETUP)

caretup

7 (CARETDOWN)

caretdown

8 (CARETLEFTBASE)

caretleft (centered at base)

9 (CARETRIGHTBASE)

caretright (centered at base)

10 (CARETUPBASE)

caretup (centered at base)

11 (CARETDOWNBASE)

caretdown (centered at base)

"None"" " or ""

 

nothing

'$...$'

Render the string using mathtext. E.g "$f$" for marker showing the letter f.

verts

 

A list of (x, y) pairs used for Path vertices. The center of the marker is located at (0, 0) and the size is normalized, such that the created path is encapsulated inside the unit cell.

path

 

Path instance.

(numsides, 0, angle)

 

A regular polygon with numsides sides, rotated by angle.

(numsides, 1, angle)

 

A star-like symbol with numsides sides, rotated by angle.

(numsides, 2, angle)

 

An asterisk with numsides sides, rotated by angle.

 

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,下面是使用Matplotlib绘制带线性刻度标记的正弦函数或余弦函数的六幅小图组成一张图组图的代码实现: ```python import numpy as np import matplotlib.pyplot as plt x = np.linspace(-2*np.pi, 2*np.pi, 1000) y_sin = np.sin(x) y_cos = np.cos(x) fig, axs = plt.subplots(2, 3, figsize=(15, 8)) fig.suptitle('Sine and Cosine Functions with Linear Scale Markers') axs[0, 0].plot(x, y_sin) axs[0, 0].set_title('Default') axs[0, 0].xaxis.set_tick_params(which='major', length=5, width=1, direction='in') axs[0, 0].yaxis.set_tick_params(which='major', length=5, width=1, direction='in') axs[0, 1].plot(x, y_sin) axs[0, 1].set_title('x = 8') axs[0, 1].set_xlim(8, -8) axs[0, 1].xaxis.set_tick_params(which='major', length=5, width=1, direction='in') axs[0, 1].yaxis.set_tick_params(which='major', length=5, width=1, direction='in') axs[0, 2].plot(x, y_sin) axs[0, 2].set_title('x = (30, 8)') axs[0, 2].set_xlim(30, 8) axs[0, 2].xaxis.set_tick_params(which='major', length=5, width=1, direction='in') axs[0, 2].yaxis.set_tick_params(which='major', length=5, width=1, direction='in') axs[1, 0].plot(x, y_sin) axs[1, 0].set_title('x = [16, 24, 32]') axs[1, 0].set_xticks([16, 24, 32]) axs[1, 0].xaxis.set_tick_params(which='major', length=5, width=1, direction='in') axs[1, 0].yaxis.set_tick_params(which='major', length=5, width=1, direction='in') axs[1, 1].plot(x, y_sin) axs[1, 1].set_title('x = [0, -1]') axs[1, 1].set_xlim(0, -1) axs[1, 1].xaxis.set_tick_params(which='major', length=5, width=1, direction='in') axs[1, 1].yaxis.set_tick_params(which='major', length=5, width=1, direction='in') axs[1, 2].plot(x, y_sin) axs[1, 2].set_title('x = slice(100, 200, 3)') axs[1, 2].set_xticks(np.arange(100, 201, 20)) axs[1, 2].xaxis.set_tick_params(which='major', length=5, width=1, direction='in') axs[1, 2].yaxis.set_tick_params(which='major', length=5, width=1, direction='in') plt.show() ``` 在这个例子中,我们使用`np.linspace`生成了一个包含1000个点的x轴坐标的数组,范围是从-2π到2π。然后,我们使用`np.sin`和`np.cos`函数分别生成了正弦函数和余弦函数的y轴坐标数组。接下来,我们使用`plt.subplots`函数创建了一个2行3列的子图矩阵,并使用`fig.suptitle`函数设置整个图组的标题。然后,我们使用`axs`变量来访问每个子图,并使用`plot`函数绘制正弦或余弦函数的曲线。我们还使用`set_title`函数为每个子图设置标题,并使用`set_xticks`函数设置x轴的刻度值。最后,我们使用`xaxis.set_tick_params`和`yaxis.set_tick_params`函数设置坐标轴的刻度线长度、宽度和方向。最终,使用`plt.show`函数展示整个图组。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值