plot画虚线 您所在的位置:网站首页 r语言plot虚线 plot画虚线

plot画虚线

#plot画虚线| 来源: 网络整理| 查看: 265

Given the following:

import matplotlib.pyplot as plt

import numpy as np

#http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.scatter

x = np.random.randn(60)

y = np.random.randn(60)

x2 = np.random.randn(60)

y2 = np.random.randn(60)

plt.plot(x, y, marker='o', markeredgecolor='r', linestyle='none', markerfacecolor='none')

plt.plot(x2, y2, marker='o', markeredgecolor='r', linestyle='none', markerfacecolor='none')

plt.show()

I'd like for x2 and y2 to be plotted as dashed (or even dotted) circles. I am avoiding the use of plt.scatter because the rest of my script works with plt.plot much better.

Here's what I'm looking for:

25363be8314ab1fb8ea617bf0d47ac8a.png

Thanks in advance!

FYI:

Here's the actual chart I created. I just used hexagons for now to signify the different data (future data).

a225325e1613fbd5d5ad67719b4e9061.png

The custom legend and plotting over groups of rows in a pandas Data Frame add layers of complexity that I couldn't overcome with plt.scatter.

解决方案

You can use the dotted circle (ur'$\u25CC$') from the STIX font (pdf with all symbols here) using mathtext functionality

plt.plot(x, y, marker=ur'$\u25CC$', markerfacecolor='r',

markeredgecolor='r', markersize=30, linestyle='none', )

Note, that markerfacecolor is set to a color as well.

A drawback is that they need a certain size to be distinguishable from a closed circle.



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有