How to plot a useful graph with a lot of data
31 views (last 30 days)
Show older comments
I am trying to plot graphs for different variables against crash risk however each variable has nearly 62000 columns down so my graphs are coming out as shown above with no analysis really being able to be done at all. Just wondering if anyone at any tips
6 Comments
Mario Malic
on 21 Dec 2023
Maybe you should try to analyze your data w.r.t. car brands, years, categories of accidents?
Accepted Answer
SAI SRUJAN
on 27 Dec 2023
Hi Danny,
I understand that you are trying to plot graphs for a very large dataset, with each variable having around 62,000 data points.
This is a common challenge when working with large datasets, as traditional plotting methods can become ineffective due to overplotting, where too many data points overlap and make the plot unreadable. In the context of MATLAB, there are several functions and approaches that can help you manage and analyze your large dataset effectively:
Follow the given code snippet to proceed further,
% To sample your dataset,
% you can use the datasample function or simply use indexing to select a subset of your data.
sample_data = datasample(data, 1000, 'Replace', false);
% To decimate your data,
% MATLAB provides the decimate function, which reduces the sample rate of a signal by an integer factor.
decimated_data = decimate(data, factor);
%If you need to resample your data to a new fixed rate, you can use the resample function.
[resampled_data, new_time] = resample(data, original_time, new_rate);
For a comprehensive understanding of the mentioned functions in MATLAB, please refer to the following documentation.
I hope this helps.
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!