-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wrong colour when second model plots into empty axes #19
Comments
lukashergt
pushed a commit
that referenced
this issue
Jul 10, 2019
This addresses issue #19. * Plotting a model with more parameters after a model with fewer parameters resulted in the wrong colour in the axes with the unshared parameters, because the more parameter model was the only one drawing there so defaulted to the first colour from the color cycle. * Dummy plots of the form `plt.plot([], [])` and `plt.scatter([], [])` increment the colour cycle without actually drawing anything. Because plot and scatter work with separate colour cycles we indeed need to call both of them. Changes to be committed: * modified: anesthetic/plot.py * modified: anesthetic/samples.py
lukashergt
pushed a commit
that referenced
this issue
Jul 11, 2019
* Code clean-up * Updated docstrings * Added some further tests * Fixed closing bracket in documentation * Code compiles, but now fails some tests * Tests now passing * Updated the make_2d_plot docstring * Merge fixes * Removed blank line at end of file * Trying to shut more figures * Removed hist test * write test for in test/test_plot.py * fix assertions in test_hist_1d * remove `ax` keyword from call to `hist` in `hist_1d` * The `ax` keyword only works with astropy's `hist` function. Instead we now set the current axis using `plt.sca` such that we then can remove the `ax` keyword in the call to `hist`. Changes to be committed: * modified: anesthetic/plot.py * distinguish between requirements.txt and requirements_minimal.txt and test both in .travis.yml * close plots in test_read_montepython consistent with other tests * make get_legend_proxy compatible with plt.scatter plots `plt.scatter` returns a different object than `plt.plot` so `get_legend_proxy` needed to be expanded to take this into account. Changes to be committed: * modified: anesthetic/plot.py * check axes parameter is valid key before drawing Check whether parameters are valid keys in `plot_2d` first before passing them on to `plot`, else a KeyError is raised when plotting a model that does not have one of the axes parameters (e.g. 'r' is in rLCDM but not in LCDM). Changes to be committed: *modified: anesthetic/samples.py * add dummy plots to increment color cycle This addresses issue #19. * Plotting a model with more parameters after a model with fewer parameters resulted in the wrong colour in the axes with the unshared parameters, because the more parameter model was the only one drawing there so defaulted to the first colour from the color cycle. * Dummy plots of the form `plt.plot([], [])` and `plt.scatter([], [])` increment the colour cycle without actually drawing anything. Because plot and scatter work with separate colour cycles we indeed need to call both of them. Changes to be committed: * modified: anesthetic/plot.py * modified: anesthetic/samples.py * Neatened up incrementation loop * Changed default of types * Updated tests
Has this issue been resolved by #15 ? |
fixed in #15 |
5 tasks
This causes issues again. In the image below anything labelled mp = MCMCSamples(root="./tests/example_data/mp")
pc = NestedSamples(root="./tests/example_data/pc")
fig = plt.figure(figsize=(10, 10))
fig, axes = make_2d_axes(['x0', 'x1', 'x2', 'x3', 'x4'], fig=fig);
mp.plot_2d(axes, label="mp");
pc.plot_2d(axes, label="pc");
for y, rows in axes.iterrows():
for x, ax in rows.iteritems():
ax.legend() |
5 tasks
5 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When plotting 2 models one of which has more parameters than the other, e.g. LCDM and rLCDM, and if we then plot the model with less parameters first including the unshared parameter, then the second model will have the wrong colour in the axes with the unshared parameter.
The colour should be dependent on the call to
plot_2d
and thus on the model. It should not depend on whether any axis is drawn in for the first or subsequent time.Example code:
Note, how in the above code the second model gets the additional keyword
ls='--'
which shows that rLCDM is drawn in orange in the upper two axes rows and blue in the bottom row.For now this behaviour can be circumvented by plotting the model with the most parameters first. This won't help in cases where two models each have an additional parameter not shared with the other, though, say e.g. r+LCDM and alpha+LCDM.
The text was updated successfully, but these errors were encountered: