Discrete vs continuous (dimension vs measure) for dates in tableau - graph

I'm currently learning tableau and was creating a graph to map the unemployment with respect to each month. As the period of time was a measure, I dragged it in and it resulted in aggregation by month (of all years together) and a graph was displayed as such:
Now to plot it monthly for each subsequent year, I checked online and saw the conversion method where the same MONTH(PERIOD) was converted to a measure and it resulted in a plot like this:
Could someone please explain why does this work and how is a measure responsible for displaying data in such a way and not the month dimension. I cannot understand the plots when both the axes are measures.
Thank you

...saw the conversion method where the same MONTH(PERIOD) was converted to a measure.
It's not converted to a measure. Period is still a dimension, just a Continuous one. Measures and dimensions in Tableau can be either Continuous or Discrete. The ability to convert one to another depends on the data type of your field. For example, Dates can be converted between Continuous and Discrete, but Strings can't. The green colour isn't for measures - it's for the Continuous type of either measure or dimension.

Related

How to show actual values instead of sum/average on y-axis in a plot using Power BI

I have an excel sheet which I am plotting two values over time. But when I plot it in Power BI it shows the sum of those values in y-axis rather than the actual value. The plot looks like the following.
If you see the y-axis they are in billions. But if you see the actual data below its in hundred thousands range.
If I use date hierarchy instead this is how it looks like.
Since your data is on specific days, you should use dates on your axis rather than weekends. When you have weekends on the axis, it groups all the days within that week together, which is not what you want.
Edit:
After looking at your file, it has nothing to do with dates after all. It looks like the data is recorded at a weekly level. The reason its adding up like that though is that for each date there are a bunch of different rows that correspond to different geography (your geo column has state name abbreviations).
If you add a slicer for geo and look at the chart for a single state at a time, then I think you'll get more what you're expecting.

what is the difference between QCPFinancial and QCPGraph?

I have a realtime and big(> milions point) graph.
Which class should i use: QCPGraph or QCPFinancial?
What are the advantages and disadvantages of each?
They are two different types of graphs. I don't think there is an advantage of one over the other. It depends on what you want to represent in your graph.
QCPFinancial:
A plottable representing a financial stock chart.
This plottable represents time series data binned to certain
intervals, mainly used for stock charts. The two common
representations OHLC (Open-High-Low-Close) bars and Candlesticks can
be set via setChartStyle.
QCPGraph:
A plottable representing a graph in a plot.
Graphs are used to
display single-valued data. Single-valued means that there should only
be one data point per unique key coordinate. In other words, the graph
can't have loops. If you do want to plot non-single-valued curves,
rather use the QCPCurve plottable.
See also this example for a simple QCPGraph.
Or this example for QCPFinancial.

How do I plot two values against each other in tableau

I have two values I wish to plot against each other in tableau. They are two totals aggregated around the same date. I can get them to the point where they are plotted on a dual access against the date like so:
but any attempt to plot them against each other for correlation has come to nothing. I've tried simple conversion to scatterplot, using calculated fields, using a cross tab with subtitles and attempting to only plot the subtotals against each other all of which have failed. I could do it in Excel but have to do it in tableau.
I have consulted the official Tableau 9.0 guide, google and existing questions on Stack Overflow all to no avail. If I was doing this in BOXI, I could just select the columns and chart them. How do I do the equivalent visualisation in Tableau?
You aren't clear about what type of chart you want to make.
Do you want a scatter plot? If so, put one measure on the row shelf, the other measure on the column shelf, and one or more dimensions (such as your date) on the detail shelf to define how finely to aggregate the data. Check the aggregation functions you use (SUM, AVG) and the aggregation level for your date fields (YEAR, MONTH ...) as desired. You probably want to use the second block of date aggregations on the menu unless you want to group all January data together regardless of year.
If you want a connected scatter plot, set the mark type from automatic to line and move the date field from the detail to the path shelf. You might also then want to put the date on size, color or legend to visually show the direction of time on the line. You might need to change that field to attribute in some cases to avoid creating multiple lines.
Tableau is fantastic once you learn how it works, and get a strong understanding of how choices about treating fields as dimensions or measures, or discrete or continuous impacts the behavior. If you skim over those details, you can still make beautiful charts by following recipes, mimicking examples (and asking StackOverflow), but Tableau's behavior will seem mysterious and arbitrary.
If you take some time to learn the fundamentals about how Tableau works, it will repay your time investment. I recommend Joshua Milligan's book Learning Tableau for a good way to start, along with the training videos on the Tableau website.

Plotting arrays of datetime x and y in highcharts heatmap

According to the highcharts Docs it should be possible to supply series data to a heatmap in the form [datetime, value], but every jsfiddle example I've seen uses the cartesian form of [x, y, value].
My datetime timestamps are unix time in milliseconds, so all of the required data is available, i.e. date, time and corresponding value, so there is no reason why highcharts should need this time-stamped data to be manipulated into an increasing index.
This guy's question seems to be the closest example I can find, but he himself reverts to using a workaround function
Unexplected results with Highcharts Heatmap
When I followed a similar approach (slightly different for me as I've got 15min intervals) Highcharts seems to interpret the unix timestamp for x-axis labelling correctly, but not for the tooltip or y-axis.
Surely there is a more sensible way of doing this?

Splitting lme residual plot into separate boxplots

Using the basic plot function (plot.intervals.lmList) from an lme model (called meef1), I produced a massive graph of boxplots. My vector v2andv3commoditycombined has 98 levels.
plot(meef1, v2andv3commoditycombined~resid(.))
I would like to separate by the grouping values of my variable v2andv3commoditycombined to either graph them separately, order them, or exclude some. I'm not sure if there is code to do this or if I have to extract information from the lme output. If that is the case, I'm not sure what to extract to create the boxplots as extracting the residuals returns only one value for each level. If this is impossible, any advice on how to space out the commodity names would be equally helpful.
Thank you.
For each level of v2andv3commoditycombined, what exactly would you like your Y axis and your X axis to be? Since you're splitting the plots by v2andv3commoditycombined, you obviously can't also use that as one of your axes.
Let's pretend you just want do the traditional residuals on the Y axis and fitted values on the X axis, in a separate plot for each of the 98 levels. You can change the code to do plot whatever it is you actually want to plot.
As per ?plot.lme, you would do something like this:
plot(meef1,resid(.,type='pearson',level=1)~fitted(.,level=1)|v2andv3commoditycombined);
Make sure you stretch out your plot window beforehand so that it's nice and big, otherwise you might get an error saying something about margins. The following might produce a better-looking plot:
plot(meef1,resid(.,type='pearson',level=1)~fitted(.,level=1)|v2andv3commoditycombined,pch='.',cex=1.5,abline=0);
Since it wasn't clear from your question I went ahead and assumed you're interested in the individual level residuals (i.e. how much each datapoint differs from the predicted value given its random variables), and that you have one level of nesting in your random formula. If you want population residuals (i.e. how much each datapoint differs from the average predicted value), change both instances of level to say level=0. If you have K levels of nesting, change them to level=K and good luck.
I also assumed you wanted standardized residuals (because you can use the convenient rule of thumb that absolute values greater than 3 are possible outliers, regardless of what scale the original data are on). If not, see ?residuals.lme for other valid options for the type argument.
Oh, and the name of your variables suggests that you're looking at some sort of financial time series. If so, have a look at ACF(meef1) to see if there is a lot of autocorrelation. If there is, you could remedy it by instead fitting a model where the response (Y) variable is diff(...) the original variable. If you're seeing really skewed residuals, you might consider log-transforming your response variable before taking the diff.

Resources