plotly and week number line graph - graph

I am trying to graph the weekly evolution of the number of downloads.
I have data similar data for all o week year and plotly cut de line.
example:
Downloads_weekly=Downloads.groupby(['Week_Number']).agg({'Daily Installs' : 'sum'})
fig1=px.line(Downloads_weekly.reset_index() , x='Week_Number' , y= 'Daily Installs')
fig1.update_xaxes(
tickformat="%Y-%W"
)
fig1

I have the exact same issue- Im still trying to figure it out. What I think is that Plotly is converting the dates to months, anyway it becomes a big mess. The way I solve the problem is by hacking around it, I create my Year-Week columns
df['Year-Week'] = df['Date'].dt.strftime('%Y.%U')
And then I sort the data frame, and plot that
df.sort_values(['Year-Week'], ascending=True, inplace=True)

Related

I have data grouped by UK financial year but when I try to use an R time series function with a frequency of 4 and then plot it, I get a strange chart

I have a table as follows:
Data table
I am trying to do a time series analysis in R. After importing the data set into R, when I use the following
time_series <- ts(ts_data$Recruitment, start= min(ts_data$Quarter),end=max(ts_data$Quarter),frequency=4)
and then use plot() to chart it, I get a chart with peaks in the wrong places. However when I set a frequency of 1 things look more normal. My question is, given that I'm dealing with quarterly data, shouldn't the frequency be 4?
I am very new to R and appreciate any advice. I saw the following example in a training course with a frequency of 4 that seemed to work, so I'm not sure why mine doesn't.
Quarterly data
Could it be to do with UK financial vs calendar year I wonder?
I tried using the frequency of 4 and then of 1. 1 seemed to produce the chart I was expecting, but 4 didn't. I'm not sure why as I'm dealing with quarterly data.
UPDATE
When I try with frequency 1 and then try to decompose the chart I get the following error:
"time series has no or less than 2 periods"
Can anybody help?

R timeseries jumps and plotting in dygraph

I have a time series of stock data of several days, and big jumps in between the days as the data in the closing time of the stock market is missing of course.
Picture shows what I mean:
Graph
The time series used to plot is an xts object, which looks like this:
xts object
The graph is plotted using the following function:
dygraph(stocks, main="Closing Stock Prices") %>%
dyAxis("y", label="Value") %>%
dySeries("..1",label="IBM") %>%
dyOptions(colors = c("blue"), connectSeparatedPoints=TRUE) %>%
dyRangeSelector()
Now what I really want is to "ignore" the value in between set dates and just plot the graph in one go without the gap between. Is this possible somehow?
I was thinking of just manipulating the time series and just consider as it single points as I don't necessarily need the time anyway but only the graph to be shown properly, but is this possible even as the xts object requires a time series object?!
Thanks in advance!!
Apparently there is no solution to hide it, other than going for NA values to hide the graph itself, but the gap which still exist.
I now went for a generated timestamp misused as index to simulate the effect of an ongoing graph.

Weekly time series plot in R

I am trying to create a plot of weekly data. Though this is not the exact problem I am having it illustrates it well. Basically imagine you want to make a plot of 1,2,....,7 for for 7 weeks from Jan 1 2015. So basically my plot should just be a line that trends upward but instead I get 7 different lines. I tried the code (and some other to no avail). Help would be greatly appreciated.
startDate = "2015-01-01"
endDate = "2015-02-19"
y=c(1,2,3,4,5,6,7)
tsy=ts(y,start=as.Date(startDate),end=as.Date(endDate))
plot(tsy)
You are plotting both the time and y together as individual plots.
Instead use:
plot(y)
lines(y)
Also, create a date column based on the specifics you gave which will be a time series. From here you can add the date on the x-axis to easily see how your variable changes over time.
To make your life easier I think your first step should be to create a (xts) time series object (install/load the xts-package), then it is a piece of cake to plot, subset or do whatever you like with the series.
Build your vector of dates as a sequence with start/end date:
seq( as.Date("2011-07-01"), by=1, len=7)
and your data vector: 1:7
a one-liner builds and plots the above time series object:
plot(as.xts(1:7,order.by=seq( as.Date("2011-07-01"), by=1, len=7)))

Trying to plot graph in R using shiny , it is taking lot of time to load, data is somewhat 1 TB

I am trying to ploat a graph using ggplot. its asingle sales graph where x axis is year and y axis is sales in the particulat year using shiny framework in R. the input file contain dales detail for every day. Complete data size for approx 1 TB. Graph is getting plotted but it is taking lot of time approx 5 mins. please suggest any solution for the same.
thanks in advance
You can buy Solid-state drive to get faster loading of data if R supports.

R graphics plotting a linegraph with date/time horizontally along x-axis

I want to get a linegraph in R which has Time along x and temperature along y.
Originally I had the data in dd/mm/yyyy hh:mm format, with a time point every 30 minutes.
https://www.dropbox.com/s/q35y1rfila0va1h/Data_logger_S65a_Ania.csv
Since I couldn't find a way of reading this into R, I formatted the data to make it into dd/mm/yyyy and added a column 'time' with 1-48 for all the time points for each day
https://www.dropbox.com/s/65ogxzyvuzteqxv/temp.csv
This is what I have so far:
temp<-read.csv("temp.csv",as.is=T)
temp$date<-as.Date(temp$date, format="%d/%m/%Y")
#inputting date in correct format
plot(temperature ~ date, temp, type="n")
#drawing a blank plot with axes, but without data
lines(temp$date, temp$temperature,type="o")
#type o is a line overlaid on top of points.
This stacks the points up vertically, which is not what I want, and stacks all the time points (1-48) for each day all together on the same date.
Any advice would be much appreciated on how to get this horizontal, and ordered by time as well as date.

Resources