1. 程式人生 > >plot函式屬性(轉自matplotlib)

plot函式屬性(轉自matplotlib)

matplotlib.pyplot.plot(*args**kwargs)

Plot lines and/or markers to the Axesargs is a variable length argument, allowing for multiple xy pairs with an optional format string. For example, each of the following is legal:

plot(x, y)         # plot x and y using default line style and color
plot
(x, y, 'bo') # plot x and y using blue circle markers plot(y) # plot y using x as index array 0..N-1 plot(y, 'r+') # ditto, but with red plusses

If x and/or y is 2-dimensional, then the corresponding columns will be plotted.

An arbitrary number of xyfmt groups can be specified, as in:

a.plot(x1, y1, 'g^', x2, y2, 'g-')

Return value is a list of lines that were added.

By default, each line is assigned a different color specified by a ‘color cycle’. To change this behavior, you can edit the axes.color_cycle rcParam. Alternatively, you can use set_default_color_cycle().

The following format string characters are accepted to control the line style or marker:

character description
'-' solid line style
'--' dashed line style
'-.' dash-dot line style
':' dotted line style
'.' point marker
',' pixel marker
'o' circle marker
'v' triangle_down marker
'^' triangle_up marker
'<' triangle_left marker
'>' triangle_right marker
'1' tri_down marker
'2' tri_up marker
'3' tri_left marker
'4' tri_right marker
's' square marker
'p' pentagon marker
'*' star marker
'h' hexagon1 marker
'H' hexagon2 marker
'+' plus marker
'x' x marker
'D' diamond marker
'd' thin_diamond marker
'|' vline marker
'_' hline marker

The following color abbreviations are supported:

character color
‘b’ blue
‘g’ green
‘r’ red
‘c’ cyan
‘m’ magenta
‘y’ yellow
‘k’ black
‘w’ white

In addition, you can specify colors in many weird and wonderful ways, including full names ('green'), hex strings ('#008000'), RGB or RGBA tuples ((0,1,0,1)) or grayscale intensities as a string ('0.8'). Of these, the string specifications can be used in place of a fmt group, but the tuple forms can be used only as kwargs.

Line styles and colors are combined in a single format string, as in 'bo' for blue circles.

The kwargs can be used to set line properties (any property that has a set_* method). You can use this to set a line label (for auto legends), linewidth, anitialising, marker face color, etc. Here is an example:

plot([1,2,3], [1,2,3], 'go-', label='line 1', linewidth=2)
plot([1,2,3], [1,4,9], 'rs',  label='line 2')
axis([0, 4, 0, 10])
legend()

If you make multiple lines with one plot command, the kwargs apply to all those lines, e.g.:

plot(x1, y1, x2, y2, antialised=False)

Neither line will be antialiased.

You do not need to use format strings, which are just abbreviations. All of the line properties can be controlled by keyword arguments. For example, you can set the color, marker, linestyle, and markercolor with:

plot(x, y, color='green', linestyle='dashed', marker='o',
     markerfacecolor='blue', markersize=12).

See Line2D for details.

The kwargs are Line2D properties:

Property Description
alpha float (0.0 transparent through 1.0 opaque)
[True | False]
axes an Axes instance
[True | False]
color or c any matplotlib color
a callable function
[‘butt’ | ‘round’ | ‘projecting’]
[‘miter’ | ‘round’ | ‘bevel’]
sequence of on/off ink in points
data 2D array (rows are x, y) or two 1D arrays
[ ‘default’ | ‘steps’ | ‘steps-pre’ | ‘steps-mid’ | ‘steps-post’ ]
[‘full’ | ‘left’ | ‘right’ | ‘bottom’ | ‘top’ | ‘none’]
gid an id string
label string or anything printable with ‘%s’ conversion.
'-' | '--' | '-.' | ':' | 'None' | ' ' | '' ] and any drawstyle in combination with a linestyle, e.g. 'steps--'.
float value in points
lod [True | False]
7 | 4 | 5 | 6 | 'o' | 'D' | 'h' | 'H' | '_' | '' | 'None' | ' ' | None | '8' | 'p' | ',' | '+' | '.' | 's' | '*' | 'd' | 3 |0 | 1 | 2 | '1' | '3' | '4' | '2' | 'v' | '<' | '>' | '^' | '|' | 'x' | '$...$' | tuple | Nx2 array ]
any matplotlib color
float value in points
any matplotlib color
None | integer | (startind, stride)
float distance in points or callable pick function fn(artist, event)
float distance in points
[True | False | None]
snap unknown
[‘butt’ | ‘round’ | ‘projecting’]
[‘miter’ | ‘round’ | ‘bevel’]
url a url string
[True | False]
xdata 1D array
ydata 1D array
any number

kwargs scalex and scaley, if defined, are passed on to autoscale_view() to determine whether the x and y axes are autoscaled; the default is True.

Additional kwargs: hold = [True|False] overrides default hold state

相關推薦

plot函式屬性matplotlib

matplotlib.pyplot.plot(*args, **kwargs) Plot lines and/or markers to the Axes. args is a variable length argument, allowing for multipl

css中常見的 cursor 屬性http://www.w3school.com

指針 mov ssh 右移 tab body poi ossh idt 值描述 url 需使用的自定義光標的 URL。 註釋:請在此列表的末端始終定義一種普通的光標,以防沒有由 URL 定義的可用光標。 default 默認光標(通常是一個箭頭) auto

MSDNInternetExplorer.Application的用法及屬性解釋

using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication1 { class EventHandlers { public void OnBe

函式時間複雜度的計算詳解CSDN

轉自:http://blog.csdn.net/flyfish1986/article/details/46994347    http://www.cnblogs.com/SCAU_que/articles/1735784.html 函式的漸近增長:給定兩個函式f

Python中的函式linhaifeng

一 函式知識體系 1 什麼是函式? 2 為什麼要用函式? 3 函式的分類:內建函式與自定義函式 4 如何自定義函式 語法 定義有引數函式,及有參函式的應用場景 定義無引數函式,及無參函式的應用場景 定義空函式,及空函式的應用場景

HTTP狀態碼大全wiki

成對 節點 而是 沒有 redirect port multiple 許可 sta 1xx消息 這一類型的狀態碼,代表請求已被接受,需要繼續處理。這類響應是臨時響應,只包含狀態行和某些可選的響應頭信息,並以空行結束。由於HTTP/1.0協議中沒有定義任何1xx狀態碼,所以除

RPG遊戲設計Gameres

工作量 我們 初始化 共享 世人 生命 置疑 年輕 動作 目錄:   第一章 概述  第二章 場景  第三章 角色  第四章 道具  第五章 事件  第六章 對白  第七章 語音和音效  第八章 音樂  第九章 界面  第十章 規則  第十一章 命名第一章:概述RPG遊戲即

ubuntu中安裝meld工具-sukhoi27smk

插件 edit ges -s election load nbsp 輸入 eight Ubuntu下文件/目錄對比的軟件Meld可能有很多用戶還不是很熟悉,下文就給大家介紹如何安裝Meld和移植到Gedit下。具體內容如下所述。 Meld允許用戶查看文件、目錄間的變化。很容

ASP.NET Core 中的 WebSocket 支持MSDN

ocs 接收 緩沖 任務 ica uget 本地服務器 tcp msdn 本文介紹 ASP.NET Core 中 WebSocket 的入門方法。 WebSocket (RFC 6455) 是一個協議,支持通過 TCP 連接建立持久的雙向信道。 它用於從快速實時通信中獲益的

EF Core中DeleteBehavior的介紹MSDN

then defined nec div values tomat ack practice blank Delete behaviors Delete behaviors are defined in the DeleteBehavior enumerator type

"System.OutOfMemoryException" exception when you execute a query in SQL Server Management Studio MSDN

Symptoms When you use Microsoft SQL Server Management Studio (SSMS) to run an SQL query that returns a large amount of data, you receive an error messag

EF Core中外來鍵關係的DeleteBehavior介紹MSDN

Delete behaviors Delete behaviors are defined in the DeleteBehavior enumerator type and can be passed to the OnDelete fluent API to control whether the de

規範的測試流程 51testing

 規範測試流程           需求分析:   需求分析由產品人員制定,他們要做的不是一份簡單的文件,而是細化每一個功能的細節,每一個按鈕的位置,對於稍大或複雜一點的需求都進行建模。   需求評審:   需求評審(產品需求人員、開發

ASP.NET Core 中的 WebSocket 支援MSDN

本文介紹 ASP.NET Core 中 WebSocket 的入門方法。 WebSocket (RFC 6455) 是一個協議,支援通過 TCP 連線建立持久的雙向通道。 它用於從快速實時通訊中獲益的應用,如聊天、儀表板和遊戲應用。 如果不明白什麼是WebSocket可以參考這篇文章   系統

Linux網絡卡混雜模式cnblogs

混雜模式就是接收所有經過網絡卡的資料包,包括不是發給本機的包,即不驗證MAC地址。普通模式下網絡卡只接收發給本機的包(包括廣播包)傳遞給上層程式,其它的包一律丟棄。 一般來說,混雜模式不會影響網絡卡的正常工作,多在網路監聽工具上使用。網絡卡具有如下的幾種工作模式: 1) 廣播模式(Broad Cas

Hbase實戰教程之happybasewolfoxliu

Hbase實戰教程之happybase  wolfoxliu W    wolfoxliu 釋出於 2017/03/10 1 本文基於實驗室已經搭建好的Hadoop平臺而寫,使用Python

c++列表初始化cppreference

列表初始化 (C++11 起) C++ C++ 語言 初始化 從花括號初始化器列表初始化物件 語法 直接列表初始化 T object { arg1, arg2, ... }; (1) T { arg1, arg2, ... };

支付安全性測試 51testing

現在有不少測試朋友做的專案中,可能也會涉及到支付相關的功能。比如:做商城的,做遊戲的以及其他線上交易的網站、APP等。如果支付出了問題,或者使用者拿少的錢通過篡改請求資料購買大金額的商品,如果是實物的話,發貨前還有可能被發現。如果是虛擬商品話費、遊戲幣等就有可能造成損失。

Java記憶體模型原理總結51CTO

轉載地址:http://developer.51cto.com/art/201811/587220.htm 【51CTO.com原創稿件】這篇文章主要介紹模型產生的問題背景,解決的問題,處理思路,相關實現規則,環環相扣,希望讀者看完這篇文章後能對 Java 記憶體模型體系產生一個相對清晰的理解,知其然知其所

java程式碼注意事項 ldh_lyf

原文連結 (1)儘量指定類、方法的final修飾符 帶有final修飾符的類是不可派生的。在Java核心API中,有許多應用final的例子,例如java.lang.Str