seaborn绘制饼图
时间: 2023-07-04 14:28:30 浏览: 118
绘制饼状图
_ble_gap_start_advertising(&adv_params);
break;
case ESP_GAP_BLE_ADV_START_COMPLETE_EVT:
if (param->adv_start_cmpl.status != ESP_BT_STATUS_SUCCESS) {
ESP_LOGE(GATTS_TAG, "Advertising start failed");
}
break;
case ESP_GAP_BLE_ADV_STOP_COMPLETE_EVT:
if (param->adv_stop_cmpl.status != ESP_BT_STATUS_SUCCESS) {
ESP_LOGE(GATTS_TAG, "Advertising stop failed");
} else {
ESP_LOGI(GATTS_TAG, "Stop adv successfully");
}
break;
default:
break;
}
}
static void test_gatts_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t *param)
{
switch (event要使用Seaborn绘制饼图,你需要先安装seaborn库。然后,可以按照以下步骤) {
case ESP_GATTS_REG_EVT:
esp_ble_gap_set_device_name(TEST_DEVICE_NAME);
esp_ble_gap_config_adv_data(&adv_config);
break;
case ESP_GATTS_READ_EVT:
break;
case ESP_GATTS_WRITE_EVT:
进行绘制饼图:
1. 导入seaborn库和matplotlib库:
```python
import seaborn as sns
import matplotlib.pyplot break;
case ESP_GATTS_EXEC_WRITE_EVT:
break;
case ESP_GATTS_MTU_EVT:
break;
as plt
```
2. 创建数据:
```python
labels = ['A', 'B', 'C', 'D']
sizes = case ESP_GATTS_CONF_EVT:
break;
case ESP_GATTS_UNREG_EVT:
break;
case ESP_G [15, 30, 45, 10]
```
3. 绘制饼图:
```python
sns.set() # 设置ATTS_CREATE_EVT:
break;
case ESP_GATTS_ADD_INCL_SRVC_EVT:
break;
case ESP_GATTS_ADD_CHAR_EVT:
break;
case ESP_GATTS_ADD_CHAR_DESCR_EVT:
break;
case ESP_GATTSseaborn样式
plt.pie(sizes, labels=labels, autopct='%1.1f%%')
plt.axis('equal_DELETE_EVT:
break;
case ESP_GATTS_START_EVT:
break;
case ESP_GATTS_STOP_EVT:
break') # 设置饼图为圆形
plt.show()
```
其中,`autopct`参数用于设置饼图中每个;
case ESP_GATTS_CONNECT_EVT:
break;
case ESP_GATTS_DISCONNECT_EVT:
break;
case ESP_G部分所占比例的显示格式。
这样,就可以使用seaborn绘制饼图了。
阅读全文