Dropping results from the df might lead to df["application"].unique() returning a different list of applications. The order of applications in this list determines the order in which applications are plotted.
In order to respect the order of applications in the original DataFrame, and thereby ensure that cascade and navchart plots produced from the same projection use the same legend, we need to ensure that we do not change the application order.
Related issues
This was broken by #22. We didn't pick it up until now because the graphs we've been producing aren't strictly wrong -- it's hard to see the issue without plotting a cascade plot and navchart side-by-side.
@swright87, I don't know if the PGFplots backend already handles this correctly, or if it requires an equivalent fix. Please take a look.
Proposed changes
Make note of the application order in the DataFrame before we perform any operations which might modify it.
Ensure that the application order in the DataFrame is matches the original before plotting anything.
There might be a more efficient way to do this that doesn't require sorting the DataFrame, but the _sort_by_app_order function already existed elsewhere in the code base, making this an expedient fix.
It may also be worth discussing if this is actually the fix we want, or if we applied #22 too hastily. If we instead threw an error whenever there were duplicate results in a DataFrame (and required the user to remove them somehow) there would be no chance of this happening.
Dropping results from the
df
might lead todf["application"].unique()
returning a different list of applications. The order of applications in this list determines the order in which applications are plotted.In order to respect the order of applications in the original DataFrame, and thereby ensure that cascade and navchart plots produced from the same projection use the same legend, we need to ensure that we do not change the application order.
Related issues
This was broken by #22. We didn't pick it up until now because the graphs we've been producing aren't strictly wrong -- it's hard to see the issue without plotting a cascade plot and navchart side-by-side.
@swright87, I don't know if the PGFplots backend already handles this correctly, or if it requires an equivalent fix. Please take a look.
Proposed changes
There might be a more efficient way to do this that doesn't require sorting the DataFrame, but the
_sort_by_app_order
function already existed elsewhere in the code base, making this an expedient fix.It may also be worth discussing if this is actually the fix we want, or if we applied #22 too hastily. If we instead threw an error whenever there were duplicate results in a DataFrame (and required the user to remove them somehow) there would be no chance of this happening.