Draw 3D scatter plot edge plot based on Matlab (welfare)

?About the author: A Matlab simulation developer who loves scientific research. He cultivates his mind and improves his technology simultaneously.

For code acquisition, paper reproduction and scientific research simulation cooperation, please send a private message.

Personal homepage: Matlab Research Studio

Personal credo: Investigate things to gain knowledge.

For more complete Matlab code and simulation customization content, click

Intelligent optimization algorithm Neural network prediction Radar communication Wireless sensor Power system

Signal processing Image processing Path planning Cellular automaton Drone

Content introduction

introduction

Data visualization is a vital part of data science. By displaying data visually, we are able to better understand relationships and trends in the data. In the field of data visualization, 3D scatter plot edge plot is a powerful tool that can simultaneously display the distribution of data points and the information of edge distribution. This article will introduce the concepts, applications, and advantages of 3D scatter plot edge maps.

Overview

3D Scatter Plot Edge Plot is a chart type used for visualizing three-dimensional data. It provides a comprehensive way to display data by drawing scatter plots in three-dimensional space and displaying the distribution of data on the edges of the plot. This chart type is commonly used to explore the distribution characteristics of data, detect outliers, and observe correlations between data.

application

3D scatter plot edge maps are widely used in many fields. Here are some common application scenarios:

  1. Scientific research: In fields such as physics, biology, and chemistry, researchers often need to analyze multidimensional data sets. By using 3D scatterplot edge plots, they can better understand relationships and trends between data points to draw important conclusions about physical, biological, or chemical processes.

  2. Financial analysis: Data in the financial field usually contains multiple dimensions, such as stock prices, market indexes, and trading volumes. By using 3D scatter plot edge plots, financial analysts can better observe the relationships between different variables and discover patterns and trends hidden in the data.

  3. Geographic Information System: A Geographic Information System (GIS) is a tool for managing, analyzing, and displaying geographic data. In GIS, 3D scatter plot edge plots are widely used to visualize the distribution and correlation of geographic data. For example, researchers can use this chart type to analyze seismic data and determine correlations between seismic activity and geographic location.

Advantage

Compared with traditional 2D scatter plots, 3D scatter plot edge plots have the following advantages:

  1. Comprehensive display of data: 3D scatter plot edge plots not only show the location of data points, but also the edge distribution of the data. This allows us to more fully understand the characteristics and trends of the data.

  2. Observe the relationship between multiple variables: By drawing a scatter plot in three-dimensional space, we can observe the relationship between multiple variables. This helps uncover correlations and patterns between variables, providing deeper insights.

  3. Discover outliers: 3D scatter plot edge plots can help us quickly find outliers in the data. By looking at the marginal distribution, we can identify data points that differ from the main data set and gain a better understanding of the completeness and reliability of the data.

in conclusion

3D Scatter Plot Edge Plot is a powerful data visualization tool that can comprehensively display the distribution of data and the relationship between multiple variables. It is widely used in fields such as scientific research, financial analysis, and geographical information systems, and has the advantages of displaying data, observing relationships, and discovering outliers. As data science continues to develop, we believe that 3D scatter plot edge plots will play an important role in more fields, helping us better understand and utilize the value of data.

Code

%% How to use scatter3mpdf</code><code>?</code><code>clear</code><code>clc</code><code>close all</code><code>? </code><code>% data preparation</code><code>N=100;</code><code>dat(:,1)=linspace(0,1,N)' + 0.1*randn( N,1);</code><code>dat(:,2)=linspace(0,1,N)'.^2 + 0.1*randn(N,1);</code><code>dat (:,3)=10*(0.5-linspace(0,1,N))'.^3 + 0.1*randn(N,1);</code><code>?</code><code> % call function with degault option value</code><code>scatter3mpdf(dat(:,1),dat(:,2),dat(:,3))</code><code>exportgraphics(gcf,' scatter3mpdf_sample.png')</code><code>?</code><code>% call function with specified option value</code><code>figure</code><code>h=scatter3mpdf(dat(: ,1),dat(:,2),dat(:,3),...</code><code> "mPDFAreaRatio",0.3,...</code><code> "FunctionType\ ","cdf","Marker",'s');</code><code>% set option values after plotting</code><code>set(gca,'fontname' ,'arial')</code><code>colormap(cool)</code><code>?</code><code>?</code><code>?
??function h=scatter3mpdf(x,y,z,options)%% h=scatter3mpdf(x,y,z ,options)% SCATTER3MPDF is written by Eiji Konaka, Sep/2023% This function plotts the followings in one 3-d figure.% 3 -d scatter plot% 2-d marginalized histogram on x-y, y-z, and z-x planes using PCOLOR% function. Relative frequency is shown by cell colors.% 1-d marginalized pdf (or cdf) along x, y, and z axes.% The plotted pdf is calculated by ksdensity, instead of histogram due to% technical reasons.%% inputs% x, y, z: data vector with the same dimensions% options % mPDFAreaRatio: The size of the ratio of pdf plot area to scatter area% (default=0.5)% FunctionType: you can select the type of distribution function from% 'pdf' or 'cdf' (default='pdf')% Marker: type of marker of scatter3 function (default= 'o')%% output% h: handle of figure % note% The other options, such as colormap of PCOLOR function, can not be specified % on calling this function. ?arguments x (:,1) double y (:,1) double z (:,1) double options.mPDFAreaRatio { mustBePositive(options.mPDFAreaRatio)} =0.5 options.FunctionType {mustBeMember(options.FunctionType,{'pdf','cdf'})} = 'pdf' options.Marker ='o'endscatter3(x,y,z,'blue','Marker',options. Marker);hold on;h=gcf;?xLimVal=get(gca,'xlim');yLimVal=get(gca,'ylim');zLimVal=get(gca,'zlim');? cMap=colormap("hot");cMap=flipud(cMap);colormap([1 1 1;cMap]); xlim([0 1]);??switch options.FunctionType case 'pdf'? [N,c] = hist3([x,y]); N_pcolor = N'/max(N,[]," all"); N_pcolor(size(N_pcolor,1) + 1,size(N_pcolor,2) + 1) = 0; xl = linspace(min(x) ,max(x),size(N_pcolor,2)); % Columns of N_pcolor yl = linspace(min(y),max(y),size(N_pcolor,1)); % Rows of N_pcolor [X,Y,Z] = meshgrid(xl,yl,zLimVal(1)); X=reshape(X, size(N_pcolor)); Y=reshape(Y, size(N_pcolor)); Z=reshape(Z, size(N_pcolor)); surf(X,Y,Z, N_pcolor,'EdgeColor','none',... 'FaceAlpha',0.5);? [N ,c] = hist3([x,z]); N_pcolor = N/max(N,[],"all"); N_pcolor(size(N_pcolor ,1) + 1,size(N_pcolor,2) + 1) = 0; xl = linspace(min(x),max(x),size(N_pcolor,2)); % Columns of N_pcolor zl = linspace(min(z),max(z),size(N_pcolor,1)); % Rows of N_pcolor [X,Y,Z] = meshgrid (xl,yLimVal(2),zl); X=reshape(X, size(N_pcolor)); Y=reshape(Y, size(N_pcolor)); Z=reshape(Z, size(N_pcolor)); surfc(X,Y,Z,N_pcolor,'EdgeColor','none',...  'FaceAlpha',0.5);? [N,c] = hist3([y,z]);  N_pcolor = N/max(N,[],"all"); N_pcolor(size(N_pcolor,1) + 1,size(N_pcolor,2) + 1) = 0 ; yl = linspace(min(y),max(y),size(N_pcolor,2)); % Columns of N_pcolor zl = linspace(min(z), max(z),size(N_pcolor,1)); % Rows of N_pcolor [X,Y,Z] = meshgrid(xLimVal(2),yl,zl); X=reshape(X, size(N_pcolor)); Y=reshape(Y, size(N_pcolor)); Z=reshape(Z, size(N_pcolor)) ; surfc(X,Y,Z,N_pcolor,'EdgeColor','none',... 'FaceAlpha',0.5);? [f_pdf_x,xi]=ksdensity(x); [f_pdf_y,yi]=ksdensity(y); [f_pdf_z,zi]=ksdensity(z); plot3(xi, ... (f_pdf_x-max(f_pdf_x))/(max(f_pdf_x)-min(f_pdf_x )) ... *(yLimVal(2)-yLimVal(1))*options.mPDFAreaRatio + (yLimVal(1)), ... min(zLimVal) *ones(size(xi)), ... 'b-');? plot3((f_pdf_y-max(f_pdf_y ))/(max(f_pdf_y)-min(f_pdf_y)) ... *(xLimVal(2)-xLimVal(1))*options.mPDFAreaRatio + (xLimVal(1)), .. . yi, ... min(zLimVal)*ones(size(xi)), ... 'b-') ;? plot3((f_pdf_z-max(f_pdf_z))/(max(f_pdf_z)-min(f_pdf_z)) ... *( xLimVal(2)-xLimVal(1))*options.mPDFAreaRatio + (xLimVal(1)), ... yLimVal(2)*ones(size(yi)), ... code> zi, ... 'b-');? case 'cdf'  [N,c] = hist3([x,y]); tmp=N; for n1=1:size(N,1) for n2=1:size(N,2) tmp(n1,n2)=sum(sum(N(1:n1, 1:n2)));  end end N=tmp; N_pcolor = N'/max(N,[],"all");  N_pcolor(size(N_pcolor,1) + 1,size(N_pcolor,2) + 1) = 0; xl = linspace(min(x),max(x) ,size(N_pcolor,2)); % Columns of N_pcolor yl = linspace(min(y),max(y),size(N_pcolor,1)); % Rows of N_pcolor  [X,Y,Z] = meshgrid(xl,yl,zLimVal(1)); X=reshape(X, size(N_pcolor)); Y =reshape(Y, size(N_pcolor)); Z=reshape(Z, size(N_pcolor)); surf(X,Y,Z,N_pcolor,'EdgeColor ','none',... 'FaceAlpha',0.5);? [N,c] = hist3 ([x,z]); tmp=N; for n1=1:size(N,1) for n2=1:size (N,2) tmp(n1,n2)=sum(sum(N(1:n1, 1:n2))); end end N=tmp;? N_pcolor = N/max(N,[],"all");  N_pcolor(size(N_pcolor,1) + 1,size(N_pcolor,2) + 1) = 0; xl = linspace(min(x),max(x),size(N_pcolor ,2)); % Columns of N_pcolor zl = linspace(min(z),max(z),size(N_pcolor,1)); % Rows of N_pcolor [ X,Y,Z] = meshgrid(xl,yLimVal(2),zl); X=reshape(X, size(N_pcolor)); Y=reshape(Y , size(N_pcolor)); Z=reshape(Z, size(N_pcolor)); surfc(X,Y,Z,N_pcolor,'EdgeColor',\ 'none',... 'FaceAlpha',0.5);? [N,c] = hist3([y, z]); tmp=N; for n1=1:size(N,1) for n2=1:size(N,2 ) tmp(n1,n2)=sum(sum(N(1:n1, 1:n2))); end end code> N=tmp;? N_pcolor = N/max(N,[],"all"); N_pcolor (size(N_pcolor,1) + 1,size(N_pcolor,2) + 1) = 0; yl = linspace(min(y),max(y),size(N_pcolor,2)) ; % Columns of N_pcolor zl = linspace(min(z),max(z),size(N_pcolor,1)); % Rows of N_pcolor [X,Y, Z] = meshgrid(xLimVal(2),yl,zl); X=reshape(X, size(N_pcolor)); Y=reshape(Y, size(N_pcolor) )); Z=reshape(Z, size(N_pcolor)); surfc(X,Y,Z,N_pcolor,'EdgeColor','none' ,... 'FaceAlpha',0.5);? [f_cdf_x, x_bins]=ecdf(x);  [f_cdf_y, y_bins]=ecdf(y); [f_cdf_z, z_bins]=ecdf(z);? plot3(x_bins , ... (f_cdf_x-1)*(yLimVal(2)-yLimVal(1))*options.mPDFAreaRatio + (yLimVal(1)), ... min(zLimVal)*ones(size(x_bins)), ... 'b-');? plot3((f_cdf_y -1)*(xLimVal(2)-xLimVal(1))*options.mPDFAreaRatio + (xLimVal(1)), ... y_bins, min(zLimVal)*ones(size(x_bins) ), ... 'b-');? plot3((f_cdf_z-1)*(xLimVal(2)-xLimVal (1))*options.mPDFAreaRatio + (xLimVal(1)), ... max(yLimVal)*ones(size(y_bins)), z_bins,... 'b-');end?% 鏋犮伄杩 borrowplot3([xLimVal (1) xLimVal(1) xLimVal(2) xLimVal(2) xLimVal(1)], ... [yLimVal(1) -(yLimVal(2)-yLimVal(1))*options .mPDFAreaRatio + (yLimVal(1)) ... -(yLimVal(2)-yLimVal(1))*options.mPDFAreaRatio + (yLimVal(1)) yLimVal(1) yLimVal(1) ], ... [zLimVal(1) zLimVal(1) zLimVal(1) zLimVal(1) zLimVal(1) ],'k-' ... )?plot3([-(xLimVal(2)-xLimVal(1))*options.mPDFAreaRatio + (xLimVal(1)) xLimVal(1) ...  xLimVal(1) -(xLimVal(2)-xLimVal(1))*options.mPDFAreaRatio + (xLimVal(1)) -(xLimVal(2)-xLimVal(1))*options.mPDFAreaRatio + (xLimVal(1))], ... [yLimVal(1) yLimVal(1) yLimVal(2) yLimVal(2) yLimVal(1)], ... [zLimVal(1) zLimVal(1) zLimVal(1) zLimVal(1) zLimVal(1) ],'k-' ... )? plot3([-(xLimVal(2)-xLimVal(1))*options.mPDFAreaRatio + (xLimVal(1)) xLimVal(1) ... xLimVal(1 ) -(xLimVal(2)-xLimVal(1))*options.mPDFAreaRatio + (xLimVal(1)) -(xLimVal(2)-xLimVal(1))*options.mPDFAreaRatio + (xLimVal(1))], . .. [yLimVal(2) yLimVal(2) yLimVal(2) yLimVal(2) yLimVal(2)], ... [zLimVal(1) zLimVal(1) ) zLimVal(2) zLimVal(2) zLimVal(1) ],'k-' ... )hold offend< /pre>

Operation results

References

Some theories are quoted from online literature. If there is any infringement, please contact the blogger to delete it
Follow me to receive massive matlab e-books and mathematical modeling materials

Private message complete code, paper reproduction, journal cooperation, paper tutoring and scientific research simulation customization

1 Improvements and applications of various intelligent optimization algorithms
Production scheduling, economic scheduling, assembly line scheduling, charging optimization, workshop scheduling, departure optimization, reservoir scheduling, three-dimensional packing, logistics site selection, cargo space optimization, bus scheduling optimization, charging pile layout optimization, workshop layout optimization, Container ship stowage optimization, water pump combination optimization, medical resource allocation optimization, facility layout optimization, visible area base station and drone site selection optimization
2 Machine learning and deep learning
Convolutional neural network (CNN), LSTM, support vector machine (SVM), least squares support vector machine (LSSVM), extreme learning machine (ELM), kernel extreme learning machine (KELM), BP, RBF, width Learning, DBN, RF, RBF, DELM, XGBOOST, TCN realize wind power prediction, photovoltaic prediction, battery life prediction, radiation source identification, traffic flow prediction, load prediction, stock price prediction, PM2.5 concentration prediction, battery health status prediction, water body Optical parameter inversion, NLOS signal identification, accurate subway parking prediction, transformer fault diagnosis
2. Image processing
Image recognition, image segmentation, image detection, image hiding, image registration, image splicing, image fusion, image enhancement, image compressed sensing
3 Path planning
Traveling salesman problem (TSP), vehicle routing problem (VRP, MVRP, CVRP, VRPTW, etc.), UAV three-dimensional path planning, UAV collaboration, UAV formation, robot path planning, raster map path planning , multimodal transportation problems, vehicle collaborative UAV path planning, antenna linear array distribution optimization, workshop layout optimization
4 UAV application
UAV path planning, UAV control, UAV formation, UAV collaboration, UAV task allocation, and online optimization of UAV safe communication trajectories
5 Wireless sensor positioning and layout
Sensor deployment optimization, communication protocol optimization, routing optimization, target positioning optimization, Dv-Hop positioning optimization, Leach protocol optimization, WSN coverage optimization, multicast optimization, RSSI positioning optimization
6 Signal processing
Signal recognition, signal encryption, signal denoising, signal enhancement, radar signal processing, signal watermark embedding and extraction, EMG signal, EEG signal, signal timing optimization
7 Power system aspects
Microgrid optimization, reactive power optimization, distribution network reconstruction, energy storage configuration
8 Cellular Automata
Traffic flow, crowd evacuation, virus spread, crystal growth
9 Radar aspect
Kalman filter tracking, track correlation, track fusion
syntaxbug.com © 2021 All Rights Reserved.