Comments (13)
@jacobseiler Alright, I'll see if I can add that in over the next couple of days.
@manodeep They're not the same - axes would be a (nxn) list, fig.axes returns a flattened list. But inside the lists the references are the same. You can compare the id's to confirm with the below snippet:
import matplotlib.pyplot as plt
fig, axes = plt.subplots(2,2)
axes2 = fig.axes
print(axes)
print(axes2)
from chainconsumer.
Check out the plot_contour
method in v0.29.0
Example here: https://samreay.github.io/ChainConsumer/examples/customisations/plot_axis.html
Reopen if there are any issues :)
from chainconsumer.
Thanks @tmcclintock. I am trying to minimize the amount of coding involved. I was thinking of adding in a return_axes
keyword, disabled by default, that returns the used axes when requested explicitly.
@Samreay Would such a design work?
from chainconsumer.
from chainconsumer.
While this issue is a few years old, would still be a fairly useful feature to have. What's required to implement this?
from chainconsumer.
It appears that most of the work would involve reworking some of the Plotter object. At present, it internally creates the figure and axes for each of the plotting routines (just ctrl-f for "subplots").
It would be straightforward to make those optional arguments in the function, and only a bit annoying to check that the extents of the incoming axes satisfy what is required in each routine.
from chainconsumer.
Manodeep, my main concern with the first comment is that it only works when you're trying to plot the contour of 2 parameters. What is the use case when people want 3 parameters? Or two with histograms? Does matplotlib allow axes to have sub-axes, so to speak?
Im not following how adding a return_axes keyword would help. Are you suggesting chainconsumer would return axes? It returns the figure already, from which you get the axes, so I feel like I have missed the point, can you elaborate?
from chainconsumer.
+1-ing for adding an axis
keyword for plotting.
I have a Figure with multiple subplots and on each of those subplots I want to just tell ChainConsumer "Hey, only plot the contours on this specific axis, literally don't do anything else".
While I could use ChainConsumer to make multiple different figures and then stitch them together in post, it feels like a round-a-bout and hacky solution.
from chainconsumer.
@Samreay Realised that I never responded to your comment.
I am not sure how to retrieve the axes from the figure object. Do you mind showing an example?
from chainconsumer.
@jacobseiler so maybe the best usecase is you pass in an axis (maybe to a different method) and say - plot the contour of these two parameters here please and thats all it does. That could work without too much hassle I think!
@manodeep I believe this should work axes = fig.axes
from chainconsumer.
@Samreay I have tried that in ipython. From what I recall, the ipython autocomplete implied that the fig.axes
was not the same as what you would get from plt.subplot
. For instance, can you confirm that fig.axes
and axes
are the same object in this line?
from chainconsumer.
@Samreay That sounds like the best option. Since I don't do heavy statistical analysis or corner style plots or anything fancy, I honestly use ChainConsumer to just easily plot contours.
Having a method that literally just accepts an axis and plots 2-parmater contours on the axis, without touching any labels/ticks/resizing/etc, would be perfection.
from chainconsumer.
@Samreay Many thanks!
from chainconsumer.
Related Issues (20)
- ImportError: cannot import name 'Chain' from 'chainconsumer' HOT 2
- Plot truth in marginal distributions HOT 2
- [Bug] Wrong count of `walkers` after the chain division
- Plot of contour is getting cut. HOT 9
- Chain labels/legends when using `plot_contour`. HOT 2
- Problems with `typing_extensions` HOT 2
- Different renderer for summary text and axis labels HOT 1
- Chain straight from dict / chain from numpyro with only certain fields HOT 7
- [Bug] Wrong type returned by `get_bins` HOT 1
- Removing certain entries from legends
- Add a weight option to chainconsumer
- Conda install for python 3.9 HOT 1
- Plotting color scatter plot without contours HOT 1
- RuntimeError: Failed to process string with tex because latex could not be found HOT 3
- Bad parameter label visualization and 1D contours not matching 2D ones HOT 2
- Mathtex parsing bugs HOT 1
- Feature request : Option to parse a custom fig instance HOT 2
- How to change tick width and height in the corner plots ? HOT 1
- adding yaxis label to distribution plots
- Title bug when `display=True` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chainconsumer.