Grain Distribution Graph in matplotlib - python

I am trying to make a graph with matplotlib like the one shown here. The problem I'm running into, is the top part of the graph. I already tried the table option from matplotlib but couldn't get it to work. Another idea is plotting my data over a backgroundimage made with inkscape (Problem is, I don't have any idea how to reference the backgroundimage so that the plot is scientifically correct/precise). So my questions are:
Do you think it is possible with the table option from matplotlib (and i should dig deeper)?
Or is my backgroundimage idea the better choice?
Or is there a complete different approach?
Thanks in advance

Related

Python: Plot multiple distributions on top of each other with y-shift

I was looking at a research paper and saw this diagram:
I believe I remember seeing a python plot for this - does anyone know a library or plot I can use to create this?

Simplest way to publish matplotlib-like interactive animation to html?

I'm using matplotlib and python to make an animated scatter plot with points as 'balls' that bounce around, just like this:
https://jakevdp.github.io/downloads/videos/particle_box.mp4
It is interactive at runtime (with sliders to change velocity, attraction, etc), simulating on the go.
I would like to then publish it with the interactivity and all in html.
Problem: I don't know of a way to publish matplotlib interactivity to html directly.
So can I do it in python? Or is there a better way?
Which library (or program, if different from python) would you recommend as the simplest and fastest for this kind of project? I don't need "pretty" customizations and all that, I just need easy calculations and simulations (python) to then plot in a few easy lines of code (matplotlib). I do need to change the dots (balls) colors though.
I have looked at mpld3 that should wrap matplotlib around D3js. But I don't know anything about js and it is not very straightforward, so it would take me a bit to learn.
I have also looked at plotly, but it doesn't seem to have the same customization of the animation I need.
I have looked at Dash with plotly, but it would be a whole new environment to learn, and definitely overkill.
So the questions are: is there a way to output matplotlib interactive animations to html that I haven't found?
If not, what tools would you use to accomplish this project within a fast timeframe and shallow learning curve, based on my beginner/low intermediate python and matplotlib skill level?
Thank you!

Can I visualize the outer box of 3D plot?

My current plot looks something like this now,
image1
But I'd like to add outer boarders so that I can have a closed box.
Like this,
image2
I am currently using Python3.6,
matplotlib.pyplot
I know that MATLAB gives such options(these images are from MATLAB documentation), so I thought matplotlib may provide the same. But I have failed to find any documentations regarding this issue.
Do I have such options to visualize the outer box, or should I use another package instead?
You may try the method set_frame_on from the class Axes on the current axes.

Is there a way to add a title or a caption to the drawing using graph_tool

At least some workaround would be appreciated. I am trying to save the figures as pdfs and then use it with latex as an animation. If there is a way to automatically add captions that will be really helpful as I am going to have about 50-60 figures.
I don't know if it is possible natively, but you can put the graph drawn by graph-tool in a matplotlib Figure() using the mplfig option in graph_draw(). With that you have access to all the flexibility of matplotlib around your graph.

Is there an equivalent to the Matlab figure window in Python (with all tools)?

I'm just wondering if it exists an equivalent to the Matlab figure window in Python where we can modify plots directly from the figure window, or add some features (text, box , arrow, and so on), or make curve fitting, etc.
Matplotlib is good, but it is not as high-level as the Matlab figure. We need to code everything and if we want to modify plots, we need to modify the code directly (except for some basic stuffs like modifing the line color)
With matplotlib, you will indeed remain in the "code it all" workflow. This is not directly the answer you expect but the matplotlib documentation recently gained a very instructive figure that will probably help you if you stay with matplotlib: http://matplotlib.org/examples/showcase/anatomy.html shows the "anatomy" of the figure with all the proper designations for the parts of the figure.
Overall, I could always find examples of what I needed in their excellent gallery http://matplotlib.org/gallery.html
In my opinion, you'll save time by coding these customizations instead of doing them by hand. You may indeed feel otherwise but if not there is a ton of examples of matplotlib code on SO, in their docs and a large community of people around it :-)

Categories