JCSDA-internal / eva

Evaluation and Verification of the Analysis
Apache License 2.0
5 stars 12 forks source link

Add mechanism for line plots to only include positive values on the xaxis #171

Open EdwardSafford-NOAA opened 8 months ago

EdwardSafford-NOAA commented 8 months ago

Description

When plotting via emcpy a line plot with all 0 values configures the xaxis with 0 in the center, negative values to the left, and positive to the right. While correct, a clearer solution for plots that cannot be negative (i.e. obs counts) is to place 0 at the origin and only include positive xtick values. This can be done in the input yaml file by explicitly setting the xtick values to start at 0. But that is guesswork, since the data hasn't been loaded at that point, and could result in an undesirable xaxis if the data values are quite large.

Perhaps a better solution is to detect an all 0 value data situation and then (and only then) explicitly set xtick values.

Requirements

None

Acceptance Criteria (Definition of Done)

The xaxis tick values for all 0 valued line plots begins at the axis origin and does not include any negative values.

Dependencies

None

EdwardSafford-NOAA commented 8 months ago

This is the problem. The q130_00 plot (correctly) has no data:

q130_0 time

Starting the xaxis ticks at -0.04 is not incorrect but it's a bit awkward in my mind.

EdwardSafford-NOAA commented 8 months ago

The problem is timing/order of operations. As described above I can explicitly set the xtick locations in the input yaml file, but at that point I can only guess if there is no data, and if there's a lot of data, the xtick locations may mean the correct upper values are not shown in the plot.

If I try using set_xlim: [0, None] in my input yaml file I get an error that None is an unknown value. That syntax for set_xlim is correct, 0 is the left value and None is a legitimate right value. But in this context, per the matplotlib docs, None means no change, and I suspect that the xaxis has no known tick values at the point at which set_xlimis being posted, so unknown is, correctly reported as an illegal value.

When I know for sure that a given subplot has all 0 values for x I don't have access to the plot configuration, I'm down in the layer processing which handles the sub-plots. I'm going to keep poking around that for a while longer though -- it looks like that's the only way I could solve this given the order of operations.