11
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

matplotlibでマーカーを枠線より上に表示する

Posted at

デモ

Before After
clip_on_0.png clip_on_1.png

方法

plotに、clip_on=Falseを追加。

demo.py
import numpy as np
import matplotlib.pyplot as plt

x = np.arange(4)
y = np.cos(x)

plt.plot(x, y, "o-", clip_on=False)
plt.xlim(0, 3)
plt.ylim(-1, 1)

注意

clip_on=Falseで、範囲指定ミスるとこうなる。つまり、clip_on=Falseではみ出しOKな状態になってる。

Unknown.png

import numpy as np
import matplotlib.pyplot as plt

x = np.arange(10)
y = np.cos(x)

plt.plot(x, y, "o-", clip_on=False)
plt.xlim(0, 3)
plt.ylim(-1, 1)

参考

python - How do I let my matplotlib plot go beyond the axes? - Stack Overflow
http://stackoverflow.com/questions/9912206/how-do-i-let-my-matplotlib-plot-go-beyond-the-axes

11
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?