%% 寻找原始数据位置 [order,location1]=sort(data(:,1),'ascend'); [~,location2]=sort(location1,'ascend'); [order_1,location_1]=sort(data(:,3),'ascend'); [order_2,location_2]=sort(data(:,5),'ascend'); %% pre_1=data(location_1,4); % pre_1=pre_1(location2); reall_1=order_1(location2); pre_2=data(location_2,6); % pre_2=pre_2(location2); % reall_2=order_2(location2); zhijie=data(location1,2); %% figure plot(zhijie ,order,'db','LineWidth',1) hold on plot(pre_1,order,'sc','LineWidth',1) hold on plot(pre_2 ,order,'om','LineWidth',1) hold on plot([0 160],[0 160],'--k','LineWidth',1) set(gca,'fontsize',18) xlabel('\fontname{Times New Roman}Predicted value\fontname{Times New Roman}/MW','FontWeight','bold','FontSize',18,'LineWidth',0.5) ylabel('\fontname{Times New Roman}Actual value\fontname{Times New Roman}/MW','FontWeight','bold','FontSize',18,'LineWidth',0.5) label=legend('\fontname{Times New Roman}None cluster','\fontname{Times New Roman}First cluster','\fontname{Times New Roman}Second cluster','location','best'); set(label,'Fontname', 'Times New Roman','FontWeight','bold','FontSize',18,'LineWidth',0.5) set(gca,'FontName','Times New Roman','linewidth',1.8) set(gca, 'box', 'off') set(gca,'LooseInset',get(gca,'TightInset'))
时间: 2023-08-20 11:57:31 浏览: 41
这部分代码是用于绘制预测值和实际值之间的对比图。首先,你根据原始数据的第一列对数据进行排序,并获得排序后的位置信息。然后,你根据位置信息重新排序预测值和真实值,并将它们存储在`pre_1`、`reall_1`、`pre_2`和`zhijie`中。
接下来,你使用`figure`创建一个新的图形窗口,并使用`plot`绘制了真实值与预测值之间的对比曲线。其中,蓝色的点代表原始数据,紫色的点代表一次聚类结果,橙色的点代表二次聚类结果。虚线表示理想情况下预测值和真实值完全一致的情况。
最后,你使用`xlabel`、`ylabel`、`legend`等函数设置了坐标轴标签和图例,并对图形进行了一些样式设置。
相关问题
<template> <el-row> <basic-container> <avue-crud :option="option" :table-loading="loading" :data="dataList" :options="tableOptions" :page="page" :search="query" :permission="permissionList" :before-open="beforeOpen" :sortKey="sortKey" :sortOrder="sortOrder" :default-sort = "{prop: 'statusTime', order: 'String'}" @sort-change="handleSortChange" v-model="form" ref="crud" @row-update="rowUpdate" @row-save="rowSave" @row-del="rowDel" @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad"> <template slot="menuLeft" > <el-button type="primary" size="small" icon="el-icon-delete" plain ref="form" v-model="form" :option="option" @click="handleDelete">删 除 </el-button> </template> export default { data() { return { column: [ { label: "设备组", prop: "groupId", filters:true, search: "true", dicData:[], //清空 // clearable:false, type: 'tree', rules: [{ required: true, message: "请输入设备名", trigger: "blur" }] },] }}} 基于AVUE 框架 在自定义的删除按钮 绑定 设备组的搜索框 的输入值 输入搜索信息 点击删除按钮 获取到当前输入框的值
你可以使用AVUE框架来自定义删除按钮,并将设备组的搜索框的输入值与删除按钮绑定。下面是一个示例代码,展示了如何在点击删除按钮时获取当前搜索框的值:
```html
<template>
<el-row>
<basic-container>
<avue-crud
:option="option"
:table-loading="loading"
:data="dataList"
:options="tableOptions"
:page="page"
:search="query"
:permission="permissionList"
:before-open="beforeOpen"
:sortKey="sortKey"
:sortOrder="sortOrder"
:default-sort="{ prop: 'statusTime', order: 'String' }"
@sort-change="handleSortChange"
v-model="form"
ref="crud"
@row-update="rowUpdate"
@row-save="rowSave"
@row-del="rowDel"
@search-change="searchChange"
@search-reset="searchReset"
@selection-change="selectionChange"
@current-change="currentChange"
@size-change="sizeChange"
@refresh-change="refreshChange"
@on-load="onLoad"
>
<template slot="menuLeft">
<el-button
type="primary"
size="small"
icon="el-icon-delete"
plain
ref="form"
v-model="form"
:option="option"
@click="handleDelete"
>
删除
</el-button>
</template>
</avue-crud>
</basic-container>
</el-row>
</template>
<script>
export default {
data() {
return {
column: [
{
label: "设备组",
prop: "groupId",
filters: true,
search: true,
dicData: [],
//清空
// clearable:false,
type: 'tree',
rules: [
{
required: true,
message: "请输入设备名",
trigger: "blur"
}
]
}
],
form: {}, // 表单数据
query: {}, // 搜索数据
};
},
methods: {
handleDelete() {
// 获取当前搜索框的值
const groupId = this.query.groupId;
console.log(groupId);
// 在这里执行删除操作
},
},
};
</script>
```
在这个示例中,我们在AVue CRUD组件中添加了一个自定义的删除按钮,并将其绑定到`handleDelete`方法。在`handleDelete`方法中,我们可以通过`this.query.groupId`获取当前搜索框的值,并进行相应的操作。请根据实际情况修改代码,并执行适当的删除操作。
<avue-crud :option="option" :table-loading="loading" :data="dataList" :options="tableOptions" :page="page" :permission="permissionList" :before-open="beforeOpen" :sortKey="sortKey" :sortOrder="sortOrder" :default-sort = "{prop: 'statusTime', order: 'String'}" @sort-change="handleSortChange" v-model="form" ref="crud" @row-update="rowUpdate" @row-save="rowSave" @row-del="rowDel" @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad"> searchChange(params, done) {} 其中的params 参数的值从哪获取的
在 Avue 中,当搜索框的值发生变化时,会触发 `search-change` 事件,并传递一个 `params` 参数。您可以在事件处理函数中获取 `params` 参数的值。
在您提供的代码中,`searchChange` 是一个事件处理函数,它接收两个参数 `params` 和 `done`。其中,`params` 参数就是从搜索框获取的值。
您可以像下面这样定义 `searchChange` 方法来处理搜索框的变化:
```javascript
methods: {
searchChange(params, done) {
// 在这里可以获取到搜索框的值
console.log(params);
// 执行搜索操作...
// 调用 done 方法告诉 Avue 搜索已完成
done();
}
}
```
在 `searchChange` 方法中,可以通过 `params` 参数获取搜索框的值。您可以根据需要使用这个值进行搜索操作。最后,调用 `done` 方法告诉 Avue 搜索已完成,以便更新相关的状态。
请注意,这里的 `search-change` 事件是由 Avue 组件内部触发的,您无需手动调用它。只需要在组件上添加 `@search-change="searchChange"` 即可监听到事件并执行相应的方法。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)