Saturday, 24 September 2016

Final daisy plot for visualising head wind when cycling.

Got there in the end. I know he guidance is that colour is not the best way to show variation, but this 'daisy plot' works for me, and is less untidy than the 'thorn' variation.

The curved line comes from those explicitly drawn by ggplot in the geom_poly statement, so repeating the start point of the poly gave me a balanced curve on both sides (which gives a clue as to how to get straight lines, but I'm sticking with this version).

Quite a lot of ggplot in the end:

ggplot(y8p , aes(x, y, group = windHead, alpha = numObs)) + 
  scale_alpha(range = c(0.3, 1), breaks = seq(0, 24000, by = 4000)) + 
  geom_polygon(fill = "blue") +
  xlab("Angle = Wind heading (deg) ") + 
  ylab("Mean wind speed (km/h)") +
  labs(alpha = "Observations") +
  coord_polar(start = -pi/8) + 
  scale_y_reverse(limits = c(maxKMH, 0)) + 
  scale_x_continuous(limits = c(-22.5,337.5), breaks = NULL) +
  geom_label(aes(x=0, y = maxKMH, label = station), colour = "black",
             show.legend = FALSE) +
  #theme(legend.position = c(1,0), legend.justification = c(1,0)) + 
  theme(strip.background = element_blank(),
        strip.text.x = element_blank()) +
  facet_wrap( ~ station)

For which, the y8p data looks like this. Note that I've created 4 lines for each real line of data - and x and y give the 4 points used in the polygon for each real point of data.

  station windHead   windKPH numObs     x         y
    <chr>   <fctr>     <dbl>  <int> <dbl>     <dbl>
1    EBBR        0  9.167982   7190   0.0  9.167982
2    EBBR        0  9.167982   7190  22.5  0.000000
3    EBBR        0  9.167982   7190 -22.5  0.000000
4    EBBR        0  9.167982   7190   0.0  9.167982
5    EBBR       45 10.177946   7358  45.0 10.177946
6    EBBR       45 10.177946   7358  67.5  0.000000

More Pies, Roses and Thorns

Continuing the hunt for ways to show headwind, rather prettier are these version, using an explicit geom_polygon to construct triangles.

In the first version, I'm using both transparency and thickness to code the number of observations (frequency that the wind was in this direction). I think this looks like thorns. Haven't worked out why the axis transform should put the twist on the triangles. Suggestions welcome!

In the second version, I've stuck to fixed width. This is more like the diaphragm of a camera, or a daisy.

Thursday, 22 September 2016

Pies and Roses

On a slight tangent from my usual data, I always have the impression that there is more of a headwind when I'm cycling home, than when I go to work. Is it true?

Happily someone has kindly archived weather observations from the nearby Brussels airport, so I've been looking at the last 5 years' or so.

The question is, how to show it? For an R user, this is the fairly obvious answer - using coord_polar() in the lovely ggplot. To a trained eye, perhaps it's clear that going to work (heading North-East), typical winds are low whereas in the reverse direction the average wind is much stronger (the upper teens). 

But to me, the impact is back to front; it feels like it's easier, somehow, to cycle south-west. And there's no indication of how frequently the wind is in each direction.

So I want to reverse the scale. Now the length of the shape gives the strength of the wind, with the baseline on the outside, and the width of the base of the shape gives the frequency of the wind being in this direction.

Ok, so it looks like a messed up version of the dreaded pie chart, but is the impact of the message clearer?



Tuesday, 2 August 2016

Eurostat air passenger data updated again

I've been having issues loading the Eurostat data with the R package RJSDMX - always timing out at work, and a different configuration error at home. 

In the meantime, the R package 'eurostat' has come along, so I've converted to using this to exploit Eurostat's newish bulk download interface. (Again time-out problems trying to use anything like a filter on this - suggestions are welcome. Could be linked to firewall issues at work but no time to investigate this.)

Anyway, the pax data are now updated (using avia_par_xx). 2015 would be complete, but Poland is missing Q4. 




Sunday, 3 July 2016

Tableau URLs for aviation stats.

The Pax (& PaxTextVn), dashboards now work with URLs to pass parameters, but it has been a dull process. Basically, in spite of what I read on forums and Tableau help, it does not seem to be possible to pass a space as %20. After many different attempts, I've just had to remove spaces from some data fields, and some parameter and field names.

So now, you can access the data directly with a URL such as:

https://public.tableau.com/profile/david.marsh#!/vizhome/Pax/LoadFactors&Year=2014&GeoDepLevel=Region&GeoDepLevelSelected=EU28&GeoDesLevel=Region

or 

https://public.tableau.com/profile/david.marsh#!/vizhome/Pax/DeparturePatterns&Year=2012

In the latter case, it's not yet simple to work out how to pass the airport parameter. Watch this space for improvements here.


Thursday, 5 May 2016

Air passenger data updated

I've also updated the passenger data. Again, all states seem to have provided data up to at least June 2015. See the link above.

For those of you using SDMX, there are more code changes to download these data:
  • PASS_BRD_DEP has become PAS_BRD_DEP
  • PASS_ST_DEP has become ST_PAS_DEP
  • PASS_CAF_DEP has become CAF_PAS_DEP

Cargo updated

It's been a while since I updated the cargo dashboard in Tableau.
Now it has the latest 2015 data. These are complete for 31 states from Jan 2008 to June 2015. There is already data for 20 states in December 2015, but we'll have to wait for the full 2015 data.

See the link at the top of the page for access to Tableau.

If any of you are using SDMX to access these Eurostat aviation data (avia_gor_xx), note that they've changed a code for one of the dimensions: from FRM_CAF_DEP to CAF_FRM_DEP. Obvious! Apart from that the update process was smooth (thanks to the RJSDMX package maintainers in R, and all the other R and Tableau folk).