Difficulty in plotting time series data on plotly - time-series

Here is a screenshot of the data:
And here is the output I am getting:
This is the sort of plot I'm trying to get. This one is plotted using sns
This is the code I'm trying:
merged['Date'] = pd.to_datetime(merged['Date']
merged = merged.sort_values('Date')
fig=px.line(merged, x='Date', y='Weekly_Sales')
fig.show()
Thanks in advance.

Related

raw.plot() not plotting time series in eeg data

I am using mne to read my EEG data. When I am doing raw.plot(), I am getting an image of this type, rather than a time series. I am unable to interpret this. Please help.
You can see here: https://mne.discourse.group/t/plotting-eeg-data-too-big-and-scroll-does-not-work/2533. Had the same problem, and doing scalings='auto' actually helped. Hope it helps you too:)

Is there a way to plot more than 1000 points in a scatter plot using the Highcharts .NET Wrapper?

I've seen some posts that mention a 1000 point limit, which is what I am encountering. I'm using Highsoft.Web.Mvc.Charts
Perhaps there is a different way than to use, Highcharts with Chart.Type = ChartType.Scatter and Series with a ScatterSeries?
According to the comments - disabling the series.turboThreshold allows rendering a higher amount of points.
API: https://dotnet.highcharts.com/Help/Highcharts/html/class_highsoft_1_1_web_1_1_mvc_1_1_charts_1_1_plot_options_scatter.html#a3674387e934212eb1327e07c29678d9f

Octave returns "Octave GUI has stopped working" error when printing a plot with a large number of points

I am using GNU Octave (v4.0.2) under Windows 10 to plot large time series comprising more than 5,000,000 points.
The time series are created by merging and decimating data from individual mat files using a "for" loop:
dec1=5; %decimation factor for stages 1 and 2
dec2=2; %decimation factor for stage 3
files=dir('*.mat');
nof=size(files,1);
ts=[];
for k=1:nof
temp=load(files(k).name);
dectemp=decimate(decimate(decimate(temp.data,dec1,5),dec1,5),dec2,5);
ts=[ts dectemp];
end
Octave has no problem plotting the time series, but crashes down if I am trying to print out the current figure to a file. For instance, trying to print the figure to a png file:
plot(ts); print('test.png');
yields the following message: "Octave GUI has stopped working".
According to this post, "big prints" were a known problem with older versions of Octave, but it seems v4.0.1. had this issue fixed. Has anyone encountered this problem? Is there a way to fix it other than decimating the time series to reduce the overall number of points?
Thanks for your help!

highcharts/highstock tooltips issue : point.config[2] missing, fine on subset of same data

I'm evaluating Highcharts. It is a brilliant charting solution but I've hit a problem I just cannot work out.
I have a dataset where each point has x, y, and additional data in an array for example:
[[1432022880000,6,['192.168.100.144','36215','192.168.100.191','5432','tcp']],
[[1432022880002,4,['192.168.100.144','36216','192.168.100.191','5432','tcp']],
...
I use a custom tooltip formatter to show the conversation details, which relies the metadata in the array at point.config[2]
With a fairly modest dataset size of about 300 points the tooltips won't function and I get the following in the console:
TypeError: 'undefined' is not an object (evaluating 'this.point.config[2][0]')
However, it works fine with a subset of the exact same data. Unless I've missed something there's nothing wrong the larger dataset but I'm completely stuck for what is happening. In the code of the app I use setData to update the larger series and although there are no errors thrown onto the console the point config objects lack the array at [2], and it works fine for the smaller dataset.
Here's a fiddle for the smaller(subset) of data, where the tooltip works:
http://jsfiddle.net/stevehicks/m37sdef5/14/
...and here's one for the "full" dataset where the problem exists:
http://jsfiddle.net/stevehicks/vhx66vgb/11/
Any help would be greatly appreciated as I've burnt over a day on this :(
Similar kind of issue has been reported in the High Charts Repos page
Bad Performance with large Series (tooltip specifically)
Follow up the issue and track the workaround provided on the page.
Kacper from the Highcharts support team has pointed out that it's the effect of datagrouping :
The problem is that large data set is grouped to fit in window and that grouped points do not have custom properties.
Grouping can be disabled.
plotOptions: {
series: {
turboThreshold: 0,
dataGrouping: {
enabled: false
}
}
},
Example with current version of Highstock : http://jsfiddle.net/vhx66vgb/12/
For older version this fix doesn't apply - no plot is being rendered: http://jsfiddle.net/vhx66vgb/13/
Many thanks to Kacper !!

Highcharts scatter plot with lots of data points running really slow

I've seen a few suggestions here, but nothing seems to apply to my situation. I've also seen some unresolved similar issues. I have scatter plot with a lot of data (about 40k) points. It's really slow. The link below (genetic data - called a Manhattan plot) will eventually load, but it's just slow. I need to find a way to optimize performance.
http://ricediversity.org/test/highcharts/examples/line-ajax/index-b.htm
Also, I'm trying to add additional info (data fields) to my tooltip from my data file, but I can't get that working either. Any suggestions?
You can try to disable animations / shadows.
http://api.highcharts.com/highcharts#chart.animation
http://api.highcharts.com/highcharts#plotOptions.series.animation
http://api.highcharts.com/highcharts#tooltip.animation
http://api.highcharts.com/highcharts#plotOptions.series.shadow
As far as tooltips, check out the highcharts data api, specifically number 2 in the list. If that doesn't cut it for you, you can pass in an array of objects where you specify the data you want to get. Then, in the formatter, it is easy to reference. Here's a JSfiddle showing how to reference the names once they're in your data array.
The formatter is
formatter: function () {
var s = "";
$.each(this.points, function (i, point) {
s += point.point.nameList[0];
});
return s;
}
and the data sets look like:
data = [ ...,
{x: xval, y: yval, nameList: myListOfNames},
...]
where xval and yval are the x and y values of the data points and myListOfNames is an array of strings.
There are some hints on optimising performance on the highcharts website here: http://docs.highcharts.com/#faq$optimize-performance
However, with that many points, I would consider using highstock. There is no way to make out the detail of that many points, so aggregating them in some way would make a better chart (http://docs.highcharts.com/#data-grouping).
Perhaps too late to be useful (and the example link no longer works, so I'm not sure if this applies), but there's a newish Highcharts plugin to downsample time series data with the intent to retain the shape of the original data.
http://www.highcharts.com/plugin-registry/single/13/Highcharts-Downsample

Resources