简体   繁体   English

如何自定义 matplotlib.figure.Figure 中的图形图形,例如更改标记大小?

[英]How can I customize my graph figures in matplotlib.figure.Figure such as changing marker size?

The following code is in my matplotlib graphing class that I embedded into tkinter, and it creates the desired figure (shape of graph is correct):以下代码在我嵌入到 tkinter 中的 class 的 matplotlib 图形中,它创建了所需的图形(图形形状正确):

df = pd.read_csv('data.csv')

fig = Figure(figsize=(12, 10), dpi=100)
fig.add_subplot(111).scatter(df['A'], df['B'])

canvas = FigureCanvasTkAgg(fig, master=self.parent)
canvas.draw()
canvas.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=1)

The problem I'm having is styling the graph.我遇到的问题是图形的样式。 How do I make the marker size significantly smaller?如何使标记尺寸显着变小? How do I customize the library to make it styled the way I want?如何自定义库以使其样式符合我的要求?

Edit: Image of how graph currently looks编辑:图形当前外观的图像

Use the s parameter of scatter?使用scatter的s参数? See examples here 在此处查看示例

fig.add_subplot(111).scatter(df['A'], df['B'], s=SOME_NUM)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从matplotlib.figure.Figure的列表中保存matplotlib图? - How to save a matplotlib figure from a list of matplotlib.figure.Figure's? 如何从 Pandas 绘图函数返回 matplotlib.figure.Figure 对象 - How to return a matplotlib.figure.Figure object from Pandas plot function 如何在不改变图形大小的情况下将轴框架定位在图形内? [Python,matplotlib] - How do I position the axis frame inside a figure without changing the size of the figure? [Python, matplotlib] matplotlib 中的 figsize 没有改变图形大小 - figsize in matplotlib is not changing the figure size 更改背景颜色后如何保存 Matplotlib 图形? - How can I save a Matplotlib figure after changing the background color? 使用matplotlib创建图形 - Create a figure of figures with matplotlib 我无法使用 matplotlib.pyplot 和使用 plt.figure(figsize = (10, 12)) 使图表的大小更大 - I can't make the size of my graph bigger using matplotlib.pyplot and using plt.figure(figsize = (10, 12)) 为什么matplotlib.figure.Figure的行为与matplotlib.pyplot.figure有很大不同 - Why does matplotlib.figure.Figure behave so different than matplotlib.pyplot.figure 如何使用macOS在matplotlib python上最大化我的数字? - How can I maximize my figure on matplotlib python using macOS? 如何在我的 matplotlib 图上设置文本? - How can I set the text on my matplotlib figure?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM