[英]How do I display drop shadows for line charts with Matplotlib?
I am trying to make a drop shadow for some data I have.我正在尝试为我拥有的一些数据制作阴影。 View the current image here
在此处查看当前图像
I can't increase the drop shadow's width.我无法增加阴影的宽度。 Is there a way to do it?
有办法吗?
Here's what I currently have:这是我目前拥有的:
plt.plot(times, past_values,color='red',path_effects=[path_effects.SimpleLineShadow(shadow_color="red"),path_effects.Normal()])
You need to pass the linewidth
argument to SimpleLineShadow
.您需要将
linewidth
参数传递给SimpleLineShadow
。
plt.plot(times, past_values,color='red',path_effects=[path_effects.SimpleLineShadow(shadow_color="red", linewidth=5),path_effects.Normal()])
You can simple add shadow=True
Here is an example您可以简单地添加
shadow=True
这是一个示例
plt.plot(times, past_values,color='red',shadow=True)
Try it it may work试试看可能有用
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.patheffects import PathPatchEffect, SimpleLineShadow, Normal
sns.set()
plt.plot([1,2,3],[1,4,9],color='red',path_effects=[SimpleLineShadow(shadow_color="red", linewidth=10),Normal()])
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.