robjohnnoble / ggmuller

Create Muller Plots of Evolutionary Dynamics
Other
64 stars 9 forks source link

Muller_pop_plot sometimes fails due to Group_id=NA #3

Closed robjohnnoble closed 7 years ago

robjohnnoble commented 7 years ago

Sometimes add_empty_pop() wrongly sets Group_id entries to NA, which causes Muller_pop_plot to fail. This is true of the following example:

edges <- get_edges(example_df) pop_df <- get_population_df(example_df) Muller_df <- get_Muller_df(edges, pop_df) Muller_pop_plot(Muller_df)

robjohnnoble commented 7 years ago

The problem seems to be with this code in add_empty_pop():

Muller_df_test$Group_id <- factor(Muller_df_test$Group_id, levels = rev( unlist(as.data.frame(Muller_dftest %>% filter(~Generation == max(Generation)) %>% select_(~Group_id)), use.names=FALSE) ))

robjohnnoble commented 7 years ago

Solution seems to be to set 'smooth_start_points = TRUE' in 'get_Muller_df'.

robjohnnoble commented 7 years ago

Solved by edit b46ca305c373b5232310f33fb2753c3611e782de.