Closed EvgeniiChaikin closed 6 months ago
It seems to me that matplotlib requires an yerr value to be passed to plot lower/upper limits correctly. For example the following code only adds limits for one of the two lines
x = np.arange(10)
y = x**2
z = x > 7
ax.errorbar(x, y, yerr=y/5, lolims=z)
ax.errorbar(x, 2*y, lolims=z)
plt.show()
I think we need to handle the case where someone wants to indicate lower/upper limits, but doesn't pass scatter values when they create the ObservationalData object. Maybe we default to yerr with a constant size in that case? I would probably be in favour of using a constant yerr size even if y_scatter is passed.
Thanks for the feedback @robjmcgibbon. I agree with your comments!
The updated version always uses the default arrow sizes, regardless of what scatter values are passed to the associate_y()
function. It also uses these default values in the case that no scatter is passed to associate_y()
.
Please let me know if the new version works for you.
I have pushed an update ensuring that the default scatter values are used to indicate lower/upper limits only if the user does not provide y scatter.
This PR adds a new functionality that enables the user to indicate lower and/or upper limits of observational data.
To specify lower/upper limits, the user will need to pass one or two bool arrays to the
associate_y()
method in the conversion script that converts the data from raw to hdf5 format.Once the raw data have been processed and saved as an hdf5 file, no further changes are required. That is: everything else in the pipeline remains the same.
For example,
I can modify
data/GalaxyHIMassFunction/convertJones2018.py
conversion script asthen I can use the standard methods to load and plot the processed data as
The resulting figure is
Note that if an observational dataset is shown as 'line' as opposed to 'scatter', then lower/upper limits will still be displayed. E.g.