NEON-biodiversity / Ostats

O-statistics (community pairwise niche overlap statistics)

Home Page:https://neon-biodiversity.github.io/Ostats/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enable plotting of discrete and circular data types

qdread opened this issue · comments

I don't know if this is still an active project but I was kind of interested in adding full functionality to Ostats_plot(). Currently, we can calculate one-dimensional Ostats for continuous data, discrete data, circular continuous data, and circular discrete data. We can do n-dimensional hypervolume Ostats for continuous data. So far, there are only plotting methods for continuous data for the one-dimensional and n-dimensional cases.

That means we need to add the ability to plot, for one dimensional Ostats,

  • discrete data
  • circular continuous data
  • circular discrete data

Discrete data should be easy, it is just a histogram instead of a kernel density. Recently, I experimented with circular figures and I have gotten a decent prototype for both discrete and continuous.

circular discrete example

Uses a subset of the ant data with counts at hours.

image

circular continuous example

This is the same data as the discrete plot. It looks different because it is "normalized" so that each species has the same area, unlike the discrete one at the moment.

image

I am planning, time permitting, to add all of these options to Ostats_plot() but it may take a long while for me to get around to actually doing it.

For completeness, here is the discrete plot normalized in the same way as the continuous plot, and with the same color scheme. All of this can be done with the code in commit df50eaa

image

More updates have been pushed to branch newplotcode

Note: also need to fix limits default for discrete non circular data type

So far everything looks good in b65ae78 in newplotcode branch. I added a lot of unit tests which all pass but they return warnings due to missing values in ggplot2. I am not sure where the warnings come from and it will not pass CRAN because they treat warnings as errors. Once I can get rid of the warnings, I will consider this resolved and put together a new release to send to CRAN.

I learned from some ggplot2 issues that you cannot make the warning go away. The way to fix it would be to set the limits in coord_cartesian() instead of scale_x_continuous which I will try to do ASAP to get rid of the warnings.